-
Notifications
You must be signed in to change notification settings - Fork 228
closing order change supernova #7776
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -581,6 +581,8 @@ func (nr *nodeRunner) executeOneComponentCreationCycle( | |||||||||||||
| goRoutinesNumberStart, | ||||||||||||||
| managedCoreComponents.ClosingNodeStarted(), | ||||||||||||||
| closeComponentsDelay, | ||||||||||||||
| managedConsensusComponents, | ||||||||||||||
| managedProcessComponents.ExecutionManager(), | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| return nextOperation == nextOperationShouldStop, nil | ||||||||||||||
|
|
@@ -998,6 +1000,8 @@ func waitForSignal( | |||||||||||||
| goRoutinesNumberStart int, | ||||||||||||||
| closingNodeStarted *atomic.Bool, | ||||||||||||||
| closeComponentsDelay time.Duration, | ||||||||||||||
| consensusComponentsCloser io.Closer, | ||||||||||||||
| executionManagerCloser io.Closer, | ||||||||||||||
| ) nextOperationForNode { | ||||||||||||||
| var sig endProcess.ArgEndProcess | ||||||||||||||
| reshuffled := false | ||||||||||||||
|
|
@@ -1020,7 +1024,7 @@ func waitForSignal( | |||||||||||||
|
|
||||||||||||||
| chanCloseComponents := make(chan struct{}) | ||||||||||||||
| go func() { | ||||||||||||||
| closeAllComponents(healthService, facade, httpServer, currentNode, chanCloseComponents, closingNodeStarted, closeComponentsDelay) | ||||||||||||||
| closeAllComponents(healthService, facade, httpServer, currentNode, chanCloseComponents, closingNodeStarted, closeComponentsDelay, consensusComponentsCloser, executionManagerCloser) | ||||||||||||||
| }() | ||||||||||||||
|
|
||||||||||||||
| select { | ||||||||||||||
|
|
@@ -1595,11 +1599,19 @@ func closeAllComponents( | |||||||||||||
| chanCloseComponents chan struct{}, | ||||||||||||||
| closingNodeStarted *atomic.Bool, | ||||||||||||||
| closeComponentsDelay time.Duration, | ||||||||||||||
| consensusComponentsCloser io.Closer, | ||||||||||||||
| executionManagerCloser io.Closer, | ||||||||||||||
| ) { | ||||||||||||||
| closingNodeStarted.Store(true) | ||||||||||||||
| // stop pruning, but wait a bit before closing the components to let the node finish processing the current block | ||||||||||||||
| time.Sleep(closeComponentsDelay) | ||||||||||||||
|
|
||||||||||||||
| log.Debug("stopping consensus...") | ||||||||||||||
| log.LogIfError(consensusComponentsCloser.Close()) | ||||||||||||||
|
|
||||||||||||||
| log.Debug("stopping async execution...") | ||||||||||||||
| log.LogIfError(executionManagerCloser.Close()) | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+1609
to
+1614
|
||||||||||||||
| log.Debug("stopping consensus...") | |
| log.LogIfError(consensusComponentsCloser.Close()) | |
| log.Debug("stopping async execution...") | |
| log.LogIfError(executionManagerCloser.Close()) | |
| // consensus and async execution are closed by their respective owners during node shutdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consensusComponentsCloser.Close()/executionManagerCloser.Close()are invoked without any nil/IsInterfaceNil guard. Since these are interface-typed parameters, a nil value (or a typed-nil) would cause a panic during shutdown. Please add a defensive nil check (consistent with thecheck.IfNil(...)pattern used elsewhere for closables) or ensure the callers always pass non-nil closers.