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

grpc-js: Defer actions in http2 stream write callback #2552

Conversation

murgatroid99
Copy link
Member

nodejs/node#49147 shows that in some rare scenarios, calling end in the write callback can put the whole session into a bad state, where the socket is closed but the session is treated as still open. This could cause the symptoms described in #2502. nodejs/node#49147 (comment) indicates that this problem does not occur if the contents of the write callback are enclosed in process.nextTick, so that's what I did here. In case stream.close in the write callback can cause the same problem, all of the code in the callback is enclosed in process.nextTick. This callback is already always asynchronous with respect to other code, so other than avoiding this bug, this change should have no observable effects to user code.

@murgatroid99 murgatroid99 merged commit cd25bad into grpc:@grpc/grpc-js@1.9.x Aug 22, 2023
4 of 5 checks passed
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.

2 participants