-
Notifications
You must be signed in to change notification settings - Fork 586
Data race on witness manager map during concurrent read and delete operations #1753
Copy link
Copy link
Closed
Description
A data race occurs in the witness manager when a map is concurrently accessed for reading and deletion without proper synchronization. The race happens at memory location 0x00c000cc7440 between:
- Read path: The witness manager's main
loop()function is reading from a map (likely iterating over witness entries) - Write path: The
forget()function is deleting entries from the same map viaruntime.mapdelete()when the block fetcher needs to forget/cleanup witness data for certain hashes
This race condition manifests when:
- The witness manager loop is actively processing or iterating over witness entries
- Simultaneously, the block fetcher is cleaning up old or invalid witness data by calling
forgetHash(), which triggers map deletions
The concurrent read and delete operations on the map without mutex protection violate Go's map safety requirements (maps are not safe for concurrent use when any goroutine is writing). This can lead to map corruption, runtime panics, or inconsistent witness tracking state. The issue requires adding proper synchronization (mutex) around all map operations in the witness manager, ensuring that reads and deletes cannot occur simultaneously.
INFO [09-09|00:42:01.772] Block building interrupted due to timeout block=310
==================
WARNING: DATA RACE
Read at 0x00c000cc7440 by goroutine 238:
github.com/ethereum/go-ethereum/eth/fetcher.(*witnessManager).loop()
/var/lib/bor/eth/fetcher/witness_manager.go:215 +0xac5
github.com/ethereum/go-ethereum/eth/fetcher.(*witnessManager).start.gowrap2()
/var/lib/bor/eth/fetcher/witness_manager.go:142 +0x33
Previous write at 0x00c000cc7440 by goroutine 236:
runtime.mapdelete()
/usr/local/go/src/runtime/map_swiss.go:144 +0x0
github.com/ethereum/go-ethereum/eth/fetcher.(*witnessManager).forget()
/var/lib/bor/eth/fetcher/witness_manager.go:751 +0x16c
github.com/ethereum/go-ethereum/eth/fetcher.(*BlockFetcher).forgetHash()
/var/lib/bor/eth/fetcher/block_fetcher.go:1310 +0x869
github.com/ethereum/go-ethereum/eth/fetcher.(*BlockFetcher).loop()
/var/lib/bor/eth/fetcher/block_fetcher.go:474 +0x2609
github.com/ethereum/go-ethereum/eth/fetcher.(*BlockFetcher).Start.gowrap1()
/var/lib/bor/eth/fetcher/block_fetcher.go:298 +0x33
Goroutine 238 (running) created at:
github.com/ethereum/go-ethereum/eth/fetcher.(*witnessManager).start()
/var/lib/bor/eth/fetcher/witness_manager.go:142 +0x144
github.com/ethereum/go-ethereum/eth/fetcher.(*BlockFetcher).Start()
/var/lib/bor/eth/fetcher/block_fetcher.go:299 +0xad
github.com/ethereum/go-ethereum/eth.(*chainSyncer).loop()
/var/lib/bor/eth/sync.go:93 +0x108
github.com/ethereum/go-ethereum/eth.(*handler).Start.gowrap3()
/var/lib/bor/eth/handler.go:576 +0x33
Goroutine 236 (running) created at:
github.com/ethereum/go-ethereum/eth/fetcher.(*BlockFetcher).Start()
/var/lib/bor/eth/fetcher/block_fetcher.go:298 +0x8a
github.com/ethereum/go-ethereum/eth.(*chainSyncer).loop()
/var/lib/bor/eth/sync.go:93 +0x108
github.com/ethereum/go-ethereum/eth.(*handler).Start.gowrap3()
/var/lib/bor/eth/handler.go:576 +0x33
==================
{
"IPT_bytes_out": 42039080,
"output_text": "WARNING: DATA RACE",
"source": {
"container": "l2-el-4-bor-heimdall-v2-rpc--73d5723f666e412987cb733cc69997f8",
"name": "l2-el-4-bor-heimdall-v2-rpc--73d5723f666e412987cb733cc69997f8",
"stream": "error"
},
"moment": {
"input_hash": "-3264817345771367523",
"_vtime_ticks": 2372065468781,
"session_id": "387aac0404473becedb39ef62b17f934-37-2"
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels