-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
core, miner, rpc, eth: fix goroutine leaks in tests #24211
Conversation
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.
Looks good to me, thanks!
485e31b
to
816864c
Compare
816864c
to
7855d61
Compare
No problem! |
core/blockchain.go
Outdated
num := number - offset | ||
recent := bc.GetBlockByNumber(num) | ||
if recent == nil { | ||
log.Error("Failed to get block", num) |
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.
log.Error("Failed to get block", num) | |
log.Error("Failed to get block", "number", num) |
core/blockchain.go
Outdated
num := number - offset | ||
recent := bc.GetBlockByNumber(num) | ||
if recent == nil { | ||
log.Error("Failed to get block", num) | ||
continue | ||
} |
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.
We'd rather revert this -- is this path triggered by the tests?
Also, the log format is wrong, would need to be log.Error("Failed to get block", "num", num)
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.
As far as I could tell, the tests didn't trigger this path, so I have reverted this change. If this happens, it indicates that something is seriously wrong, either our blockchain is corrupt, or the database is closed.
@@ -1779,6 +1779,7 @@ func testRepair(t *testing.T, tt *rewindTest, snapshots bool) { | |||
SnapshotLimit: 0, // Disable snapshot by default | |||
} | |||
) | |||
defer engine.Close() |
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.
Is it necessary to close the FullFaker
ethash engine? There is nothing to do in the Close function
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.
You're right it can't be necessary, but doing it is more correct, so I'd rather just keep it htere
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.
LGTM
* fix blocking and non-blocking issues * core: revert change in blockchain.go Co-authored-by: Martin Holst Swende <[email protected]>
* fix blocking and non-blocking issues * core: revert change in blockchain.go Co-authored-by: Martin Holst Swende <[email protected]>
This PR fixes following issues:
testRepair goroutine leak
TestRegisterHandler_Successful goroutine leak
TestStartStopMiner
TestClientReconnect
TestMinerDownloaderFirstFails
same as 3
TestBuildSchema
Node created is missing close.
TestMinerSetEtherbase
same as 3
8
TestCloseMiner
same as 3
9
testSequentialAnnouncements
10
TestEmptyBlockShortCircuit
if completing timeout happened first, sending operation of completing will be blocked
11
TestNatto
12
testRegenerateMiningBlock
if new task timeout happened first, sending operation on taskCh will be blocked
13
TestSignTx
api.List might possibly return both nil
14
TestLightInvalidNumberAnnouncement
if announce timeout happened first, sending operation might be blocked