Fix silent hang in flush when nodeShutdown returns non-recoverable error#1267
Open
alexgim961101 wants to merge 1 commit intopercona:devfrom
Open
Fix silent hang in flush when nodeShutdown returns non-recoverable error#1267alexgim961101 wants to merge 1 commit intopercona:devfrom
alexgim961101 wants to merge 1 commit intopercona:devfrom
Conversation
During physical restore, flush() calls nodeShutdown() to shut down mongod. Previously, if nodeShutdown() returned an error other than ConflictingOperationInProgress (e.g., Unauthorized when not connecting from localhost), the error was silently ignored and the code proceeded to waitMgoShutdown(), which would hang indefinitely. Extract error classification into isNonRecoverableShutdownErr() helper to make it easy to add new non-recoverable error patterns in the future. Signed-off-by: alexgim961101 <[email protected]>
25d4f7d to
ee031ae
Compare
Member
|
Hey @alexgim961101, thank you for your contribution. It looks good, we’ll perform a deeper review shortly and get back to you. |
Author
|
@boris-ilijic Thanks for the response! Take your time with the review. I'm happy to address any feedback. |
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.
Problem
During physical restore,
flush()callsnodeShutdown()to shut down mongod.If
nodeShutdown()returns an error other thanConflictingOperationInProgress(e.g.,
(Unauthorized) shutdown must run from localhost when running db without auth),the error is silently ignored due to the
if err != nil && contains(...)pattern,and the code proceeds to
waitMgoShutdown()which hangs indefinitely.Root Cause
Changes
flush()— Extract error classificationReplaced the inline
strings.Containscheck with a call to the newisNonRecoverableShutdownErr()helper:isNonRecoverableShutdownErr()— New helper functionReturns true if the error indicates mongod will not shut down and waiting
would be futile. Currently checks for:
(Unauthorized)— e.g., shutdown from non-localhost without auth(ConflictingOperationInProgress)— node already stepping downNew error patterns can be added to the
nonRecoverablePatternsslice.Testing
Tested with a 3-node replica set (MongoDB 7.0, no auth, Docker):
waitMgoShutdown()shutdown server: (Unauthorized) shutdown must run from localhost when running db without auth