go-ethereum/eth/tracers/logger
rayoo 8aeef6ae1b eth/tracers: fix data race on interruption reason across tracers
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.
2026-05-09 07:23:36 +08:00
..
access_list_tracer.go eth/tracers: fix accessList StorageKeys return null (#33976) 2026-03-11 11:46:49 +08:00
gen_callframe.go t8ntool: add optional call frames to json logger (#29353) 2024-03-27 16:12:57 +01:00
gen_structlog.go eth/tracers/logger: make structlog/json-log stack hex again (#28628) 2023-12-05 09:37:48 +01:00
logger.go eth/tracers: fix data race on interruption reason across tracers 2026-05-09 07:23:36 +08:00
logger_json.go eth/tracers/logger: fix json-logger output missing (#30804) 2024-11-25 10:07:50 +01:00
logger_test.go core/vm, eth, tests: introduce gas budget (#34712) 2026-04-20 15:33:29 +08:00