-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: switch gateway code to new API from go-libipfs #9681
Conversation
70ba1cc
to
4685809
Compare
3f0bff3
to
48178fa
Compare
943c471
to
80d8ea2
Compare
@hacdias fyi i've found panic when loading http://127.0.0.1:8080/ipns/invalid.example.net Click to see details
|
There is also something wrong with generating HTML for listing big (HAMT-sharded) directories. To reproduce:
Need to fix this and add regression test that uses HAMT directory (create CAR fixture with standalone, minimal set of blocks required for enumerating directory). |
@lidel I can't reproduce your HAMT issue. I fixed the panic.
|
@hacdias thanks! Did you try on empty repo? I've fetched your changes and http://127.0.0.1:8080/ipfs/bafybeiggvykl7skb2ndlmacg2k5modvudocffxjesexlod2pfvg5yhwrqm/ and the problem is still there. It takes forever to load dir listing on empty repo, node is fetching some stuff in the background, and after fetching ~4k blocks I see the same blank screen as before. How to reproduceTo reproduce: $ export IPFS_PATH=/home/lidel/tmp/test-refactor-$(date +"%s") && ipfs init --empty-repo && ipfs daemon and then: $ # confirm local repo has only one block
$ ipfs refs local | wc -l
1
$ # measure how long fetch took (with Accept, so test is future-proof against refactors, if we ever change default bahavior)
$ time curl -v -H "Accept: text/html" http://127.0.0.1:8080/ipfs/bafybeiggvykl7skb2ndlmacg2k5modvudocffxjesexlod2pfvg5yhwrqm/
..
$ # show how many blocks were fetched in the process
$ ipfs refs local | wc -l
? # probaby some ridiculous number (>10k) I suspect the refactor removed all optimizations we did in the past year (#8853 and made even better in #9481) and once again Kubo is fetching root nodes for all 10k of children items in directory. It takes forever to load unless you already have them in your local blockstore, so you have to How to test this on CIAfter fixing upstream, we need to add regression tests to Kubo repo to avoid the problem coming back over and over again. Perhaps:
|
6d76870
to
86ab484
Compare
dce71a5
to
d0f828b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🟢 HAMT listing looks ok, and we have a good regression test for it
- @hacdias fetch my changes, I've isolated HAMT tests from the rest and added docs why we do what we do.
- i did not rebase on
master
, would do it at the end, after adding tests mentioned below
- 🔴 We are missing the same level of confidence when it comes to Range requests.
- @hacdias do you mind adding similar test as for HAMT? (with
init --empty-repo
and refs counting)- with static fixture for two sets (overkill, but also makes sure we do proper range-requests) of 2 bytes from the middle of a big file?
- Eg.
curl http://127.0.0.1:8080/ipfs/bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze/wikipedia_en_all_maxi_2021-02.zim -i -H "Range: bytes=2000-2002, 40000000000-40000000002"
- Eg.
- confirm only minimal set of blocks got fetched
- with static fixture for two sets (overkill, but also makes sure we do proper range-requests) of 2 bytes from the middle of a big file?
- @aschmahmann fysa i think this is the only known unknown atm, so once we have test for this, we can move forward with merges.
- @hacdias do you mind adding similar test as for HAMT? (with
- 🟠 ipfs-webui tests partially pass
/webui
E2E tests are mostly green, only tests that fail are due to feat: ipfs-http-client -> kubo-rpc-client ipfs-webui#2098- @hacdias up to you if you have time to create fixtures for feat: ipfs-http-client -> kubo-rpc-client ipfs-webui#2098 and PR fix to ipfs-webui repo, or only fill a bug in https://github.com/ipfs/ipfs-webui/issues – i don't feel we should block on this.
Note regarding HAMT tests: I've added some already (7d2ae38). I will work on adding/updating them likely tomorrow. |
30e87d2
to
cb2acb9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hacdias while we wait for boxo, would you have time to move (refactor) this PR's Range/HAMT tests that do refs
counting in:
test/sharness/t0115-gateway-dir-listing.sh
test/sharness/t0110-gateway.sh
to a single place like test/cli/gateway_range_test.go
(you can eyeball prior art in gateway_test.go
).
Rationale:
- We will make @guseggert happy by not adding more sharness 👍
- Tests based on
ipfs refs local
are specific to Kubo – @laurentsenta will have less work porting to https://github.com/ipfs/gateway-conformance if we dont have them in sharness.- 💭 @laurentsenta this is an early idea for conformance tests (happy to discuss on future call, just a quick braindump here)
- we won't have access to
ipfs refs local
, but can create a CAR fixture that is like a Swiss cheese 🧀 – something that has only the blocks for requested range, AND we also ensure all the missing CIDs are unreachable (without providers, so tests will always fail/timeout – this way generic test suite will have no need for countingrefs
).
- we won't have access to
- 💭 @laurentsenta this is an early idea for conformance tests (happy to discuss on future call, just a quick braindump here)
Hmm, checking if 10k items are not present locally can take some time. We also needs a list of such CIDs (which can certainly be included in the test). I'm looking into this now. |
fe8aae6
to
fa406cf
Compare
fa406cf
to
d196423
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, checking if 10k items are not present locally can take some time. We also needs a list of such CIDs (which can certainly be included in the test). I'm looking into this now.
My bad, I'm sorry, I did not mean explicitly checking:
- If you create a synthetic DAG, that is not provided by any peer on the planet, you won't have to manually check anything.
The CAR would only have a few blocks from that DAG. - If Range request works, means the fetch was correct (limited to minimal set of blocks).
If it hangs and then timeouts, means it triggered fetch of more blocks than necessary, and missing blocks are nowhere to be found.
This way you don't need to deal with inspecting local blockstore/cache or counting refs.
In Kubo, when we run daemon in offline mode, we get this behavior already, so we only need positive test.
@hacdias mind removing the overly complicated negative ones? (details inline)
4cd5c43
to
9d632f8
Compare
25f7abb
to
1e3ad9c
Compare
Co-Authored-By: Marcin Rataj <lidel@lidel.org> Co-Authored-By: Henrique Dias <hacdias@gmail.com>
1e3ad9c
to
c080ba4
Compare
Relates to ipfs/boxo#176
Range
request sharness test for?format=raw
(discussion)