-
-
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
Bitswap sessions don't treat independent gets as independent #4674
Comments
Also, it looks like a timeout on a context passed to |
Hrm... Youre right. I didnt account for that, I generally didn't put a lot of thought into multiple callers into a single session. |
Also, it looks like canceling a get won't actually cancel the active wants. |
So, fixing this and the related bugs is starting to look like a hopeless never-ending pile of wasted work. Given that we're going to be pushing graphsync next quarter, I vote to punt and replace. Thoughts @whyrusleeping? Lessons learned:
|
@Stebalien unsure what you mean with "punt and replace". I agree with your lessons learned, but on the duplicate providers bit, I think that what we're missing is a smarter layer between the DHT and bitswap. A properly implemented providers layer should coalesce and cache identical requests, and also handle multiple outgoing provides correctly (and not make multiple DHT provide calls for the same object within a given time span). I also agree that bitswap should likely not interface with any sort of storage. Except where it has to (for getting blocks to send to peers to fulfill their requests). On the request side, the wantmanager correctly treats multiple independent requests for the same blocks as a single external request. The hard part is figuring out where to make it put that block to the blockstore, the current method of bitswap putting each block to disk as it receives them is bad. It makes the add local vs fetch remote problem hard, and makes storing multiple incoming blocks using a single batch put nearly impossible. The batching problem is becoming significantly more pressing, its causing a bottleneck when fetching data over the network. |
@Stebalien also, the problem described in the issue comment is not an issue. This is properly handled (as evidenced by the TestMultipleSessions test). |
Present @whyrusleeping,
Meet past @whyrusleeping,
(this issue is about multiple Get calls on a single session)
I mean that, given that we will need to do a large refactor anyways to make graphsync work, we might as well write that from scratch (keeping the lessons learned from bitswap in mind) as bitswap has grown quite complicated. Basically, I'm wondering if sinking any more time into bitswap is really worth it at this point. There's a lot of technical debt there.
You're absolutely right about that. That'll actually be important when we have multiple exchanges. Actually, in light of multiple exchanges..., having separate sessions kind of makes sense.
So, I'd kind of like to drive this from the top down with a dispatching DAGService that treats the exchange as a slow DAG and the local DAG as a cache (recall ipfs/notes#255). |
Ah, right. Multiple gets on the same session. Though to be clear, my comment you quoted was referring to the wantlist issue. I think that if we were to rewrite everything from scratch, we would end up with roughly what we have here. The code as it exists now has been rewritten from scratch several times already, Aside from some sessions issues, the core bitswap code works as intended. Though I will admit with the current structure its difficult to do some things we want to do, like multiple blocks per message, and batching puts to disk. |
Got it.
I may have rushed to conclusions out of frustration when trying to track down the issues in #4658. I'll take another look. I noticed we did a lot of bookkeeping in different places and it looks like a lot of this bookkeeping could be simplified and consolidated (but, I haven't tried writing anything yet so...). |
cc @hannahhoward should this issue be closed given all the recent fixes? |
It looks like this is still an issue, as far as I can tell. |
I am moving this issue to the bitswap backlog since it clearly is a thing :) |
And will prioritize |
Scenario:
Canceling ctxA will cause the second Get to block forever.
We need to reference count interest.
(Note: By inspection, I haven't confirmed this)
The text was updated successfully, but these errors were encountered: