-
Notifications
You must be signed in to change notification settings - Fork 112
[WIP] newStreamToPeer
hangs
#476
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
Yeah, I'm a bit confused as well. I think the main difference is: SendMessage is used for sending blocks, one per stream. SendMsg is used for sending wantlist messages, where we want to use a single stream. But I'm not entirely sure why... A hard-coded large enough timeout should be fine (for now) so I merged the patch. My main concern is that 5s may be too small due to backpressure in some cases... but it should be fine. |
This also brings up the more general question: we should likely be setting more timeouts in bitswap when sending data to deal with slow peers. |
Yes. At the very least I would expect (as a consumer of this library) to have some catch-all maximum timeout (even if in the order of minutes) to never reach a deadlock situation. |
I'm assuming because the wanlist broadcasting has a more regular flow to each peer than on-deman blocks, but it's just a guess. |
Yeah, we probably should have one.
That and the fact that wantlist messages tend to be small. |
I don't see a way forward that doesn't imply a big refactor, and with #477 in place I'm going to consider this fixed (at least for the short term). |
As explained in ipfs/kubo#7972 (comment)
newStreamToPeer
doesn't have a timeout in its context and stalls forever.The most direct fix (#477) is to add a timeout for a hardcoded (or make it an option somewhere) amount of time in
go-bitswap/network/ipfs_impl.go
Lines 310 to 315 in 963dc8f
I'm opening this issue to discuss potentially better fixes (which can happen either as a complement or instead of the above one).
Without a deeper BS knowledge I can find another
newStreamToPeer
call which actually does have a send timeout along with other sane options that I would expect to have when connecting/sending.go-bitswap/network/ipfs_impl.go
Lines 100 to 112 in 963dc8f
They happen in the context of the
streamMessageSender
and the interfaceMessageSender
(which seems close to the more broadly usedBitSwapNetwork
). This logic seems to be used only for the want list managment (MessageQueue
), which is handled by a different part of the code than the WANT/HAVE message processing. I don't know the exact rationale for this distinction since both deal with a lot of overlap.Looking into this some more...
The text was updated successfully, but these errors were encountered: