mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-25 09:19:28 +00:00
Fixes the deadlock noted by the "TODO this function will hang if it's called twice" markers in Tree.Disable and Tree.Rebuild. Both paths walk every layer in the tree and unconditionally invoke stopGeneration on each disk layer, so a layer reachable through both must tolerate a second call. The previous implementation sent on the unbuffered genAbort channel whenever genMarker was non-nil. After the first abort handshake the generator goroutine exits, but genMarker is only cleared on the successful-completion path (generate.go), not on the aborted-mid-flight path. A second stopGeneration therefore saw generating=true, sent on genAbort with no receiver, and blocked forever. Wrap the abort handshake in a sync.Once on the disk layer. The first call drives the handshake exactly as before; subsequent calls are no-ops. Remove both TODO comments now that the contract is honoured. Adds TestStopGenerationIdempotent: stands in a mock generator goroutine that consumes a single abort, calls stopGeneration twice, and fails with an explicit message at a 5s deadline rather than hanging until the test runner's outer timeout. Fixes #33233. |
||
|---|---|---|
| .. | ||
| pruner | ||
| snapshot | ||
| access_events.go | ||
| access_events_test.go | ||
| access_list.go | ||
| database.go | ||
| database_code.go | ||
| database_history.go | ||
| database_iterator.go | ||
| database_iterator_test.go | ||
| database_mpt.go | ||
| database_ubt.go | ||
| dump.go | ||
| iterator.go | ||
| iterator_test.go | ||
| journal.go | ||
| metrics.go | ||
| reader.go | ||
| reader_eip_7928.go | ||
| reader_eip_7928_test.go | ||
| reader_stater.go | ||
| state_object.go | ||
| state_object_test.go | ||
| state_sizer.go | ||
| state_sizer_test.go | ||
| state_test.go | ||
| statedb.go | ||
| statedb_fuzz_test.go | ||
| statedb_hooked.go | ||
| statedb_hooked_test.go | ||
| statedb_test.go | ||
| stateupdate.go | ||
| sync.go | ||
| sync_test.go | ||
| transient_storage.go | ||
| trie_prefetcher.go | ||
| trie_prefetcher_test.go | ||