-
Notifications
You must be signed in to change notification settings - Fork 45
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
GC Bug #117
Comments
Yes, indeed, there is a race condition here. Users of Let me know in case that works for you. |
For convenience of user, It seems that GC can close stream automatically when stream is dropped. |
By sending RST to the remote, you inform of the fact that the messages that the remote has sent on the substream might not have been received and processed. Sending a close message and immediately discarding the substream would be against that idea. |
My mistake, when stream is dropped, Gc should reset stream after all queued message were sent. |
It's not about sending remaining messages, but about receiving the messages that the remote might be sending to you. In your specific situation, you know that the remote doesn't send anything, but that's not the case in the absolute. |
You are right, we should send Ack alongside with RST frame if receive from the remote. |
is this bug still here? I'm getting lots of unexpected EOFs when sending big messages between two nodes, could it be relevant? EOFs start to happen when message size exceeds UPD: After several days of debugging, it turned out I didn't do |
I am not aware of it.
Do I understand correctly that this resolves the above mentioned EOF on large messages? 🎉 |
Yes! :) While we're at it, could you kindly elaborate on why requirement to call I'm looking at e.g. rust-ipfs c7a79980bd and I see that they somehow understood that they should add I want to learn how they knew about this requirement, was it communicated or expressed somewhere in the docs? Many thanks for your great work! |
Puuh, I am not sure to be honest. Maybe @koivunej knows more.
❤️ |
Thanks for the ping! Regarding the linked I'll update if/when I'll find more rationale for that close. Oki, found it I think, originally However to repeat, I cannot comment on if that close should be there, as my efforts have recently focused on trying to understand the latest windows test failures which started with the latest rust-libp2p upgrade. The bitswap protocol we have is nothing but a draft. I'll try to remember to add some disclaimers around it as well. |
This bug can still be triggered if a user calls |
…156) Currently, we have a `garbage_collect` function that checks whether any of our streams have been dropped. This can cause a race condition where the channel between a `Stream` and the `Connection` still has pending frames for a stream but dropping a stream causes us to already send a `FIN` flag for the stream. We fix this by maintaining a single channel for each stream. When a stream gets dropped, the `Receiver` becomes disconnected. We use this information to queue the correct frame (`FIN` vs `RST`) into the buffer. At this point, all previous frames have already been processed and the race condition is thus not present. Additionally, this also allows us to implement `Stream::poll_flush` by forwarding to the underlying `Sender`. Note that at present day, this only checks whether there is _space_ in the channel, not whether the items have been emitted by the `Receiver`. We have a PR upstream that might fix this: rust-lang/futures-rs#2746 Fixes: #117.
Firstly, show one case
Drop stream immediately after write message. As result, msg3 can't be received by reader.
After debug, We found that GC send RST frame before msg3.
GC send RST frame directly to reader, At the meantime, msg3 is still queueed in stream receiver.
If GC send RST frame to stream receiver, the bug will be fixed.
The text was updated successfully, but these errors were encountered: