There are similar problems in TestEmptyBlockShortCircuit, TestBlockMemoryExhaustionAttack, TestFullSequentialAnnouncements, TestLightSequentialAnnouncements, TestFullConcurrentAnnouncements and TestLightConcurrentAnnouncements.
t.Fatal will not eliminate the hang as they are it only make current goroutines exit.
Are these synchronized channels imported necessary? This leak seems can be solved by add the buffer size up to the times of function calls of verifyImport*.
verify functions in block_fetcher_test.go below will quit to recv from the channel if there is a timeout. https://github.com/ethereum/go-ethereum/blob/5e4d726e2a05aee80a75e5f99fd699f220dd503e/eth/fetcher/block_fetcher_test.go#L328-L339 And will make a hanging goroutine at the hook function in tests if the channnel buffer size is not matched with the invoke times of the verify function, for example, here in
TestHashMemoryExhaustionAttack
: https://github.com/ethereum/go-ethereum/blob/5e4d726e2a05aee80a75e5f99fd699f220dd503e/eth/fetcher/block_fetcher_test.go#L856-L857 https://github.com/ethereum/go-ethereum/blob/5e4d726e2a05aee80a75e5f99fd699f220dd503e/eth/fetcher/block_fetcher_test.go#L889-L892There are similar problems in
TestEmptyBlockShortCircuit
,TestBlockMemoryExhaustionAttack
,TestFullSequentialAnnouncements
,TestLightSequentialAnnouncements
,TestFullConcurrentAnnouncements
andTestLightConcurrentAnnouncements
. t.Fatal will not eliminate the hang as they are it only make current goroutines exit.