mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
Every tracer that implements Stop/GetResult held a `reason error` field that is written by Stop (called from the trace-timeout watchdog goroutine in api.go) and read by GetResult (called by the RPC handler main goroutine). These accesses were unsynchronized. Because Go's error is an interface, a racing reader can observe a torn eface (type pointer and data pointer from different stores), which is undefined behaviour and can crash the node. Replace the plain field with atomic.Pointer[error] in: - eth/tracers/native/call.go (callTracer) - eth/tracers/native/4byte.go (fourByteTracer) - eth/tracers/native/erc7562.go (erc7562Tracer) - eth/tracers/native/prestate.go (prestateTracer) - eth/tracers/logger/logger.go (StructLogger) The flatCallTracer shares callTracer.reason and is fixed transitively. Add TestTracerStopRace which exercises the concurrent Stop/GetResult path under -race for each of the five tracers. It fails on master with the race detector, passes after the fix. |
||
|---|---|---|
| .. | ||
| 4byte.go | ||
| call.go | ||
| call_flat.go | ||
| call_flat_test.go | ||
| erc7562.go | ||
| gen_account_json.go | ||
| gen_callframe_json.go | ||
| gen_callframewithopcodes_json.go | ||
| gen_flatcallaction_json.go | ||
| gen_flatcallresult_json.go | ||
| keccak256_preimage.go | ||
| keccak256_preimage_test.go | ||
| mux.go | ||
| noop.go | ||
| opcode_counter.go | ||
| prestate.go | ||
| tracer_test.go | ||