go-ethereum/eth/tracers
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
..
internal cmd, core, trie, triedb: split CachingDB into merkle + binary dbs. (#34700) 2026-04-17 08:55:54 +08:00
js core/vm, eth, tests: introduce gas budget (#34712) 2026-04-20 15:33:29 +08:00
live eth/tracers: fix supply tracer uncle accounting (#31882) 2025-08-26 15:44:16 +02:00
logger eth/tracers: fix data race on interruption reason across tracers 2026-05-09 07:23:36 +08:00
native eth/tracers: fix data race on interruption reason across tracers 2026-05-09 07:23:36 +08:00
api.go cmd, core, trie, triedb: split CachingDB into merkle + binary dbs. (#34700) 2026-04-17 08:55:54 +08:00
api_test.go cmd, core, trie, triedb: split CachingDB into merkle + binary dbs. (#34700) 2026-04-17 08:55:54 +08:00
dir.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
live.go eth/tracers: various fixes (#30540) 2024-10-17 06:51:47 +02:00
tracers_test.go core: implement eip-7778: block gas accounting without refunds (#33593) 2026-03-04 18:18:18 +08:00
tracker.go eth/traces: add state limit (#25812) 2022-10-06 10:48:04 +02:00
tracker_test.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00