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: Handle race between bindAsync and (try|force)Shutdown #2590

Conversation

murgatroid99
Copy link
Member

Tests shared in #2581 show that if bindAsync is called, and then tryShutdown or forceShutdown is called before the bindAsync operation completes, the result is that the port stays bound forever, holding the process open. This fixes the error by adding a shutdown flag that is set by tryShutdown and forceShutdown, and ensuring that bindAsync does not leave ports bound if that flag is set. Specifically, it throws an error if bindAsync is called after shutdown, and adds checks after getting the resolver result and in the listen callback to not continue binding ports and/or close any bound ports.

@murgatroid99 murgatroid99 merged commit 065ac2f into grpc:@grpc/grpc-js@1.9.x Oct 2, 2023
1 check passed
@murgatroid99 murgatroid99 mentioned this pull request Oct 2, 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.

2 participants