-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: fix stream only write will stuck forever #398
Conversation
59ed6e5
to
b80f064
Compare
b80f064
to
cc2e5ca
Compare
I have a quick question, how will this fix work if the window update is sent a bit later? I mean after we checked To clarify it seems it can happen that the |
if checked writeable waker is registered on the If an unexpected read operation occurs first, the writeable waker is also registered on stream when n ==0, the read part will also wake up the write part to continue. |
Can you then clarify why it didn't work before? Thanks! To clarify it can happen that we receive the update window on recv_frames before n == 0, and everything will work fine. But if we miss that, nobody will read (if we are only writing), and read part will only occur if somebody polls reader which is not the case in my situation. |
Under the previous logic, if only a The session does send a message, but its wake response is only in the read operation, and the window update message is never received by the stream(just in the channel, never pop to the stream), causing the send window to always be 0. If you add debug information to the test case, you will find that the stream has been woken up multiple times.(master branch will stuck, this PR will fine) |
Super, I actually read the code and now it makes sense :-) Indeed we take the waker from the context of the write operation and register it with frame_reciever if there are no messages, then we park the future on n == 0, then the future will be polled again as soon as frame_receiver receives the message, and we will go to |
@mcrakhman You're welcome. I'll merge this PR shortly and publish the release. |
fix driftluo#33