fix(net): stop BackupServer.close() hanging while bind is in flight - #6962
Closed
halibobo1205 wants to merge 1 commit into
Closed
fix(net): stop BackupServer.close() hanging while bind is in flight#6962halibobo1205 wants to merge 1 commit into
halibobo1205 wants to merge 1 commit into
Conversation
Fix a shutdown race where close() runs before bind() publishes the channel, leaving the server thread blocked until the 60-second executor timeout. Create the event loop group in initServer() so close() can shut it down and interrupt pending waits.
Collaborator
Author
|
Fixed by #6961 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix a
BackupServershutdown race that can causeBackupServerTestto time out.Create the event loop group in
initServer(), before the server task is submitted, soclose()can shut it down while bind is still pending.close()now interrupts the server executor and waits up to 10 seconds for the event loop group, replacing theExecutorServiceManager.shutdownAndAwaitTerminationcall that could wait up to 120 seconds across two termination waits. The server task requests group shutdown infinallywithout blocking again.Why are these changes required?
Previously,
close()closed the channel only if it had already been published, then calledExecutorServiceManager.shutdownAndAwaitTermination. If bind completed afterclose()checked the channel, nothing closed the socket, the server thread stayed parked incloseFuture().sync(), andclose()blocked inawaitTerminationlong enough to trip the test's 60-second timeout.Related CI failure (attempt 2 of that workflow run; the test failed all six attempts—the initial run plus five retries), abbreviated:
This PR has been tested by:
closeAfterStarted: waits for a successfully bound channel, closes the server, and verifies that the channel closes and both the group and executor terminate.closeWhileBindIsPending: deterministically holds bind registration pending, initiates shutdown, then releases the event loop and verifies termination.BackupManagerTestnow usesbackupServer.close()for cleanup.