Skip to content
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 recvStream hanging #54

Closed
wants to merge 1 commit into from
Closed

fix recvStream hanging #54

wants to merge 1 commit into from

Conversation

bjin
Copy link
Contributor

@bjin bjin commented May 9, 2023

If RESET_STREAM frame arrives after recvStream started pulling from RecvStreamQ (takeRecvStreamQ call in takeRecvStreamQwithSize), recvStream will hang indefinitely (until being killed by thread manager).

Fix this by pushing a pseudo FIN (empty bytestring) to RecvStreamQ.

Copy link
Owner

@kazu-yamamoto kazu-yamamoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!
If you could add a test case for this, it would be great.
This request is NOT a mandate.

@bjin
Copy link
Contributor Author

bjin commented May 10, 2023

I added two tests, simulating both cases that client/server stop the stream first.

Here client or server stop the stream by first sending STOP_SENDING followed by RESET_STREAM. This is how Chrome performs stream closing while keeping connection opened.

Without the fix, both test will fail (hang indefinitely).

If `RESET_STREAM` frame arrives after `recvStream` started pulling from
`RecvStreamQ` (`takeRecvStreamQ` call in `takeRecvStreamQwithSize`),
`recvStream` will hang indefinitely (until being killed by thread manager).

Fix this by pushing a pseudo FIN (empty bytestring) to `RecvStreamQ`.

Also add two test to ensure recvStream don't block in the cases that
server or client stop the stream. Without this fix, both tests failed.
@kazu-yamamoto kazu-yamamoto self-requested a review May 10, 2023 08:16
Copy link
Owner

@kazu-yamamoto kazu-yamamoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

kazu-yamamoto added a commit that referenced this pull request May 10, 2023
@kazu-yamamoto
Copy link
Owner

Rebased and merged.
Thank you for your contribution!
I will make a new release tomorrow.

@bjin
Copy link
Contributor Author

bjin commented May 10, 2023

Thanks!

@bjin bjin closed this May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants