This repository was archived by the owner on Aug 2, 2021. It is now read-only.
Fix goroutine leak by closing accounts manager on Node.Stop#1147
Closed
Fix goroutine leak by closing accounts manager on Node.Stop#1147
Conversation
Contributor
|
@janos I think in the upstream PR we should request a review from Felix and Peter, as I see they worked on this part mostly. That can take time, too. So what do you think about submitting this upstream? |
Member
Author
|
@frncmx yes, I'll submit upstream, to speed things up. |
Member
Author
|
Submitted upstream ethereum/go-ethereum#18505. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes: #1142
While performing the test described in #1142 issue, a large number of gorutines were created and not terminated. Stack trace shows many goroutines:
Accounts manager is created but not closed for node.Node, leaving large number of goroutines alive. This change closes accounts manager on Node.Stop, but Node initializes accounts manager in constructor, not no Start, so for Restart and Start to work as expected, accounts manager construction and closing is handled in Start as well, preserving the original required initialization in constructor.
Keystore watch creates fs watchers and we have noticed before a lot of
(FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)errors on macOS while running a large scale simulations. This change may improve simulations performance as it closes unneeded file watchers.Note: Running tests described in #1142
time go test -race -count 100 github.com/ethereum/go-ethereum/swarm/network/simulationrequire changes from PR ethereum/go-ethereum#18464 to fix race conditions, but this PR solves goroutine leak. This tests run for about 20 minutes.