Skip to content

core/filtermaps: make ChainView thread safe#31671

Merged
rjl493456442 merged 1 commit into
ethereum:masterfrom
zsfelfoldi:safe-chain-view
Apr 18, 2025
Merged

core/filtermaps: make ChainView thread safe#31671
rjl493456442 merged 1 commit into
ethereum:masterfrom
zsfelfoldi:safe-chain-view

Conversation

@zsfelfoldi
Copy link
Copy Markdown
Contributor

This PR makes filtermaps.ChainView thread safe because it is used concurrently both by the indexer and multiple matcher threads. Even though it represents an immutable view of the chain, adding a mutex lock to the blockHash function is necessary because it does so by extending its list of non-canonical hashes if the underlying blockchain is changed.
The unsafe concurrency did cause a panic once after running the unit tests for several hours and it could also happen during live operation.

@zsfelfoldi zsfelfoldi added this to the 1.15.9 milestone Apr 18, 2025
@rjl493456442 rjl493456442 merged commit 4c9e7d1 into ethereum:master Apr 18, 2025
2 of 4 checks passed
sivaratrisrinivas pushed a commit to sivaratrisrinivas/go-ethereum that referenced this pull request Apr 21, 2025
This PR makes `filtermaps.ChainView` thread safe because it is used
concurrently both by the indexer and multiple matcher threads. Even
though it represents an immutable view of the chain, adding a mutex lock
to the `blockHash` function is necessary because it does so by extending
its list of non-canonical hashes if the underlying blockchain is
changed.

The unsafe concurrency did cause a panic once after running the unit
tests for several hours and it could also happen during live operation.
0g-wh pushed a commit to 0gfoundation/0g-geth that referenced this pull request Apr 22, 2025
This PR makes `filtermaps.ChainView` thread safe because it is used
concurrently both by the indexer and multiple matcher threads. Even
though it represents an immutable view of the chain, adding a mutex lock
to the `blockHash` function is necessary because it does so by extending
its list of non-canonical hashes if the underlying blockchain is
changed.

The unsafe concurrency did cause a panic once after running the unit
tests for several hours and it could also happen during live operation.
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Jul 3, 2025
This PR makes `filtermaps.ChainView` thread safe because it is used
concurrently both by the indexer and multiple matcher threads. Even
though it represents an immutable view of the chain, adding a mutex lock
to the `blockHash` function is necessary because it does so by extending
its list of non-canonical hashes if the underlying blockchain is
changed.

The unsafe concurrency did cause a panic once after running the unit
tests for several hours and it could also happen during live operation.
howjmay pushed a commit to iotaledger/go-ethereum that referenced this pull request Aug 27, 2025
This PR makes `filtermaps.ChainView` thread safe because it is used
concurrently both by the indexer and multiple matcher threads. Even
though it represents an immutable view of the chain, adding a mutex lock
to the `blockHash` function is necessary because it does so by extending
its list of non-canonical hashes if the underlying blockchain is
changed.

The unsafe concurrency did cause a panic once after running the unit
tests for several hours and it could also happen during live operation.
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
This PR makes `filtermaps.ChainView` thread safe because it is used
concurrently both by the indexer and multiple matcher threads. Even
though it represents an immutable view of the chain, adding a mutex lock
to the `blockHash` function is necessary because it does so by extending
its list of non-canonical hashes if the underlying blockchain is
changed.

The unsafe concurrency did cause a panic once after running the unit
tests for several hours and it could also happen during live operation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants