Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: concurrent map access in multistore #1299

Closed
wants to merge 12 commits into from

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Jan 18, 2024

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • Refactor

    • Enhanced thread-safety in store operations with the addition of mutex locks.
  • Chores

    • Updated build and test workflow configurations with new installCommand parameters.

Copy link
Contributor

coderabbitai bot commented Jan 18, 2024

Walkthrough

The recent changes involve enhancing the thread safety of a Store structure in Go by introducing a read-write mutex (sync.RWMutex). This mutex is used to synchronize access to the store's internal map. Additionally, the build and test workflows in GitHub Actions have been updated to include an installCommand field, likely to set up dependencies or tooling required for the CI process.

Changes

File Path Change Summary
store/rootmulti/store.go Added sync.RWMutex to Store struct and methods for thread-safety.
.github/workflows/build.yml Added installCommand in cronos job.
.github/workflows/test.yml Added installCommand for cachix installation.

Poem

🐇 "In the realm of code, a lock now threads entwine,
🔒 Ensuring safety, with mutex's design.
🛠️ CI flows adjust, with commands so prime,
🎉 A rabbit's cheer, for a build so fine!" 🎉

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: mmsqe <[email protected]>
@mmsqe mmsqe marked this pull request as ready for review January 18, 2024 02:50
@mmsqe mmsqe requested a review from a team as a code owner January 18, 2024 02:50
@mmsqe mmsqe requested review from JayT106 and leejw51crypto and removed request for a team January 18, 2024 02:50
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ea65bfa and cb96554.
Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • store/rootmulti/store.go (5 hunks)
Additional comments: 6
store/rootmulti/store.go (5)
  • 54-54: The addition of the mutex to the Store struct is correct and necessary for thread safety.
  • 68-68: Initialization of the mutex in the NewStore function is correct.
  • 130-132: Proper use of Lock and Unlock in the Commit method to protect write operations.
  • 235-236: Correct use of RLock and RUnlock in the GetStore method to protect read operations.
  • 242-243: Correct use of RLock and RUnlock in the GetKVStore method to protect read operations.
CHANGELOG.md (1)
  • 5-5: The changelog entry is correct and provides the necessary information about the changes made.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cb96554 and 517adf8.
Files selected for processing (1)
  • store/rootmulti/store.go (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • store/rootmulti/store.go

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 517adf8 and 99f939a.
Files selected for processing (1)
  • store/rootmulti/store.go (12 hunks)
Files skipped from review as they are similar to previous changes (1)
  • store/rootmulti/store.go

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 99f939a and 728e6c5.
Files selected for processing (1)
  • store/rootmulti/store.go (11 hunks)
Additional comments: 11
store/rootmulti/store.go (11)
  • 54-54: The addition of the mutex to the Store struct is correct and necessary for thread safety.
  • 68-68: The mutex is properly initialized in the NewStore function, ensuring each Store instance is properly synchronized.
  • 65-80: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [75-88]

The use of RLock() and RUnlock() in the flush method is correct, protecting the read operation during iteration over the stores.

  • 117-125: The use of RLock() and RUnlock() in the Commit method is correct for protecting the read operation when iterating over the stores to commit them.
  • 134-138: The use of Lock() and Unlock() in the Commit method is correct for protecting the write operation when reloading the stores.
  • 190-196: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [193-203]

The use of RLock() and RUnlock() in the CacheMultiStore method is correct for protecting the read operation when copying the stores to the cache.

  • 224-230: The use of RLock() and RUnlock() in the CacheMultiStoreWithVersion method is correct for protecting the read operation when copying the stores to the cache with a specific version.
  • 242-243: The use of RLock() and defer RUnlock() in the GetStore method is correct for protecting the read operation when accessing a specific store.
  • 249-250: The use of RLock() and defer RUnlock() in the GetKVStore method is correct for protecting the read operation when accessing a specific store.
  • 306-307: The use of RLock() and defer RUnlock() in the GetCommitKVStore method is correct for protecting the read operation when accessing a specific store.
  • 382-384: The use of Lock() and Unlock() in the LoadVersionAndUpgrade method is correct for protecting the write operation when updating the stores after loading a new version.

Copy link
Collaborator

@JayT106 JayT106 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 728e6c5 and f7590af.
Files selected for processing (1)
  • store/rootmulti/store.go (11 hunks)
Files skipped from review as they are similar to previous changes (1)
  • store/rootmulti/store.go

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 19, 2024
@mmsqe mmsqe enabled auto-merge January 19, 2024 08:08
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 728e6c5 and 95953d5.
Files selected for processing (2)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/test.yml (2 hunks)
Additional comments: 2
.github/workflows/test.yml (1)
  • 47-47: The addition of the installCommand field in the cachix-action step is a good practice to ensure that the correct version of cachix is installed. However, it's important to verify that the specified version of cachix (1.6.1) is compatible with the rest of the workflow and does not introduce any breaking changes.
.github/workflows/build.yml (1)
  • 152-152: The installCommand field has been added to the cachix-action step consistently across different jobs in the workflow. This ensures that the cachix tool is installed in a controlled manner. As with the test.yml file, ensure that the specified version of cachix is compatible with the workflow requirements.

.github/workflows/test.yml Show resolved Hide resolved
@@ -63,25 +65,27 @@
keysByName: make(map[string]types.StoreKey),
stores: make(map[types.StoreKey]types.CommitKVStore),
listeners: make(map[types.StoreKey][]types.WriteListener),
mtx: sync.RWMutex{},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems not needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or do we change sync.Map to avoid concurrent map read and map write?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean don't need to init explicitly, zero value is the initial value

}
}

// flush writes all the pending change sets to memiavl tree.
func (rs *Store) flush() error {
var changeSets []*memiavl.NamedChangeSet
for key := range rs.stores {
rs.mtx.RLock()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's easy to deadlock to grab locks in private method, if it's called by another method which already grabbed locks

@@ -361,7 +379,9 @@
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not protecting the other fields? Are the access to them safe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean storesParams and keysByName, which depends on how we use but we mainly encounter stores concurrent write

@mmsqe mmsqe disabled auto-merge January 19, 2024 08:27
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 95953d5 and 072b92b.
Files selected for processing (1)
  • store/rootmulti/store.go (11 hunks)
Files skipped from review as they are similar to previous changes (1)
  • store/rootmulti/store.go

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ea65bfa) 15.98% compared to head (072b92b) 35.75%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1299       +/-   ##
===========================================
+ Coverage   15.98%   35.75%   +19.77%     
===========================================
  Files          80      116       +36     
  Lines        6201    10670     +4469     
===========================================
+ Hits          991     3815     +2824     
- Misses       5130     6478     +1348     
- Partials       80      377      +297     

see 54 files with indirect coverage changes

@@ -50,6 +51,7 @@ type Store struct {
sdk46Compact bool
// it's more efficient to export snapshot versions, we can filter out the non-snapshot versions
supportExportNonSnapshotVersion bool
mtx sync.RWMutex
Copy link
Collaborator

@yihuang yihuang Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the error without this change?
what's the difference with the cosmos-sdk's rootmulti.Store, which don't have a mutex.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get trace from testnet

6:39PM INF burned tokens from module account amount=793560000000000000basetcro from=evm module=x/bank 6:39PM INF burned tokens from module account amount=687500000000000000basetcro from=evm module=x/bank 6:39PM INF minted coins from module account amount=687500000000000000basetcro from=evm module=x/bank 6:39PM INF minted coins from module account amount=30155000000000000basetcro from=evm module=x/bank 6:39PM INF Served debug_traceTransaction conn=10.202.3.249:32398 duration=19.023694 err="rpc error: code = Internal desc = TypeError: Assignment to constant variable. at putGas (:449:32(13)) in > 6:39PM INF received proposal module=consensus proposal="Proposal{17469185/0 (04E3A24D45925907C1ECC8771468447CA1803513F8DAFF0F50454B2E888A6C71:1:BB28BAAF84FF, -1) 4911941D6EBB @ 2024-01-17T18:39:58.973407> 6:39PM INF received complete proposal block hash=04E3A24D45925907C1ECC8771468447CA1803513F8DAFF0F50454B2E888A6C71 height=17469185 module=consensus server=node 6:39PM INF finalizing commit of block hash=04E3A24D45925907C1ECC8771468447CA1803513F8DAFF0F50454B2E888A6C71 height=17469185 module=consensus num_txs=0 root=F7E790D6EB8C997D1318E0BA801C53E3CDB1CC09445BFC1> 6:39PM INF executed block height=17469185 module=state num_invalid_txs=0 num_valid_txs=0 server=node fatal error: concurrent map read and map write goroutine 98372662 [running]: github.com/crypto-org-chain/cronos/store/rootmulti.(*Store).GetKVStore(0x40065237d0?, {0x57e3ca0, 0x40002b76f0}) github.com/crypto-org-chain/cronos/store/rootmulti/store.go:235 +0x34 github.com/crypto-org-chain/cronos/versiondb.(*MultiStore).cacheMultiStore(0x40021cd1a0, 0x4028640038) github.com/crypto-org-chain/cronos/versiondb/multistore.go:44 +0xf8 github.com/crypto-org-chain/cronos/versiondb.(*MultiStore).CacheMultiStoreWithVersion(0x0?, 0x10a8f00) github.com/crypto-org-chain/cronos/versiondb/multistore.go:59 +0x40 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).CreateQueryContext(_, _, _) github.com/cosmos/cosmos-sdk/baseapp/abci.go:795 +0x174 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func1({0x5808dc8, 0x4008044150}, {0x339d240, 0x773b648}, 0x402a978080?, 0x40032da120) github.com/cosmos/cosmos-sdk/baseapp/grpcserver.go:50 +0x11c github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x5808dc8?, 0x4008044150?}, {0x339d240?, 0x773b648?}) github.com/grpc-ecosystem/go-grpc-middleware/chain.go:25 +0x3c github.com/grpc-ecosystem/go-grpc-middleware/recovery.UnaryServerInterceptor.func1({0x5808dc8?, 0x4008044150?}, {0x339d240?, 0x773b648?}, 0x4008044180?, 0x402a978080?) github.com/grpc-ecosystem/go-grpc-middleware/recovery/interceptors.go:33 +0x98 github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x5808dc8?, 0x4008044150?}, {0x339d240?, 0x773b648?}) github.com/grpc-ecosystem/go-grpc-middleware/chain.go:25 +0x3c github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1({0x5808dc8, 0x4008044150}, {0x339d240, 0x773b648}, 0x10?, 0x2f8ff60?) github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34 +0xb8 github.com/evmos/ethermint/x/evm/types._Query_Params_Handler({0x3502d80?, 0x40001523c0}, {0x5808dc8, 0x4008044150}, 0x40021e9a28?, 0x4008044180) github.com/evmos/ethermint/x/evm/types/query.pb.go:1975 +0x118 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func2({0x3502d80, 0x40001523c0}, {0x5808dc8, 0x4008044150}, 0x349d580?, 0x4005046d80?) github.com/cosmos/cosmos-sdk/baseapp/grpcserver.go:82 +0xcc google.golang.org/grpc.(*Server).processUnaryRPC(0x403f350b40, {0x58201c0, 0x40470d9860}, 0x4005046d80, 0x40470cac60, 0x40470b9490, 0x0) google.golang.org/grpc/server.go:1374 +0xb90 google.golang.org/grpc.(*Server).handleStream(0x403f350b40, {0x58201c0, 0x40470d9860}, 0x4005046d80, 0x0) google.golang.org/grpc/server.go:1751 +0x80c google.golang.org/grpc.(*Server).serveStreams.func1.1() google.golang.org/grpc/server.go:986 +0xb4 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc/server.go:997 +0x170 goroutine 1 [semacquire, 3218 minutes]: sync.runtime_Semacquire(0x0?) runtime/sema.go:62 +0x2c sync.(*WaitGroup).Wait(0x40034fee08) sync/waitgroup.go:116 +0x74 golang.org/x/sync/errgroup.(*Group).Wait(0x40034fee00) golang.org/x/sync/errgroup/errgroup.go:53 +0x2c github.com/evmos/ethermint/server.startInProcess(_, {{0x0, 0x0, 0x0}, {0x5825e80, 0x4000c3e020}, 0x4001446400, {0x400124e768, 0x13}, {0x583a020, ...}, ...}, ...) github.com/evmos/ethermint/server/start.go:631 +0x2240 github.com/evmos/ethermint/server.StartCmd.func2.2() github.com/evmos/ethermint/server/start.go:162 +0x54 github.com/evmos/ethermint/server.wrapCPUProfile(0x40015b1720, 0x400149f900) github.com/evmos/ethermint/server/start.go:692 +0x24c github.com/evmos/ethermint/server.StartCmd.func2(0x4001572900?, {0x40015b1840?, 0x0?, 0x2?}) github.com/evmos/ethermint/server/start.go:161 +0x1d8 github.com/spf13/cobra.(*Command).execute(0x4001572900, {0x40015b1820, 0x2, 0x2}) github.com/spf13/cobra/command.go:940 +0x5c4 github.com/spf13/cobra.(*Command).ExecuteC(0x400154c600) github.com/spf13/cobra/command.go:1068 +0x340 github.com/spf13/cobra.(*Command).Execute(...) github.com/spf13/cobra/command.go:992 github.com/spf13/cobra.(*Command).ExecuteContext(...) github.com/spf13/cobra/command.go:985 github.com/cosmos/cosmos-sdk/server/cmd.Execute(0x27af548?, {0x3529fa8, 0x6}, {0x40013b19e0, 0x14}) github.com/cosmos/cosmos-sdk/server/cmd/execute.go:33 +0x164 main.main() github.com/crypto-org-chain/cronos/v2/cmd/cronosd/main.go:13 +0x3c goroutine 12 [select, 3220 minutes]: github.com/desertbit/timer.timerRoutine() github.com/desertbit/timer/timers.go:119 +0xa4 created by github.com/desertbit/timer.init.0 github.com/desertbit/timer/timers.go:15 +0x24 goroutine 13 [select]: go.opencensus.io/stats/view.(*worker).start(0x4000b62680) go.opencensus.io/stats/view/worker.go:292 +0x88 created by go.opencensus.io/stats/view.init.0 go.opencensus.io/stats/view/worker.go:34 +0xa0 goroutine 14 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x0?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 15 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x4000130240?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 16 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x0?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 50 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x0?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 51 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x0?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 52 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x0?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 53 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x0?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 54 [chan receive, 3220 minutes]: github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x0?) github.com/ethereum/go-ethereum/core/sender_cacher.go:63 +0x34 created by github.com/ethereum/go-ethereum/core.newTxSenderCacher github.com/ethereum/go-ethereum/core/sender_cacher.go:55 +0x78 goroutine 55 [chan receive]: github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tick(0x76e32c0) github.com/ethereum/go-ethereum/metrics/meter.go:293 +0x54 created by github.com/ethereum/go-ethereum/metrics.NewMeterForced github.com/ethereum/go-ethereum/metrics/meter.go:71 +0xc0 goroutine 56 [select]: github.com/ethereum/go-ethereum/consensus/ethash.(*remoteSealer).loop(0x4000353e00) github.com/ethereum/go-ethereum/consensus/ethash/sealer.go:279 +0x140 created by github.com/ethereum/go-ethereum/consensus/ethash.startRemoteSealer github.com/ethereum/go-ethereum/consensus/ethash/sealer.go:263 +0x298 goroutine 21 [chan receive, 3220 minutes]: github.com/evmos/ethermint/server.ListenForQuitSignals.func1() github.com/evmos/ethermint/server/util.go:129 +0x44 github.com/evmos/ethermint/server.ListenForQuitSignals.func2() github.com/evmos/ethermint/server/util.go:137 +0x24 golang.org/x/sync/errgroup.(*Group).Go.func1() golang.org/x/sync/errgroup/errgroup.go:75 +0x5c created by golang.org/x/sync/errgroup.(*Group).Go golang.org/x/sync/errgroup/errgroup.go:72 +0x9c goroutine 37 [select]: github.com/alitto/pond.(*WorkerPool).purge(0x40010b8540) github.com/alitto/pond/pond.go:384 +0xe4 created by github.com/alitto/pond.New github.com/alitto/pond/pond.go:144 +0x1e8 goroutine 59 [chan receive]: github.com/rcrowley/go-metrics.(*meterArbiter).tick(0x76e3340) github.com/rcrowley/go-metrics/meter.go:239 +0x30 created by github.com/rcrowley/go-metrics.NewMeter github.com/rcrowley/go-metrics/meter.go:46 +0xcc goroutine 60 [syscall, 3220 minutes]: os/signal.signal_recv() runtime/sigqueue.go:152 +0x30 os/signal.loop() os/signal/signal_unix.go:23 +0x1c created by os/signal.Notify.func1.1 os/signal/signal.go:151 +0x28 goroutine 102 [select, 3220 minutes]: github.com/cometbft/cometbft/proxy.(*multiAppConn).killTMOnClientError(0x4001bd80e0) github.com/cometbft/cometbft/proxy/multi_app_conn.go:140 +0xd0 created by github.com/cometbft/cometbft/proxy.(*multiAppConn).OnStart github.com/cometbft/cometbft/proxy/multi_app_conn.go:120 +0x3c8 goroutine 103 [chan receive]: github.com/cometbft/cometbft/libs/pubsub.(*Server).loop(0x4000e7ccb0, {0x400173a4e0, 0x400173a510}) github.com/cometbft/cometbft/libs/pubsub/pubsub.go:323 +0x5c created by github.com/cometbft/cometbft/libs/pubsub.(*Server).OnStart github.com/cometbft/cometbft/libs/pubsub/pubsub.go:309 +0x94 goroutine 61 [chan receive]: github.com/cometbft/cometbft/state/txindex.(*IndexerService).OnStart.func1() github.com/cometbft/cometbft/state/txindex/indexer_service.go:62 +0x78 created by github.com/cometbft/cometbft/state/txindex.(*IndexerService).OnStart github.com/cometbft/cometbft/state/txindex/indexer_service.go:60 +0x1b0 goroutine 62 [IO wait, 3220 minutes]: internal/poll.runtime_pollWait(0xffff7df11628, 0x72) runtime/netpoll.go:306 +0xa0 internal/poll.(*pollDesc).wait(0x4001f0c100?, 0x325c6a0?, 0x0) internal/poll/fd_poll_runtime.go:84 +0x28 internal/poll.(*pollDesc).waitRead(...) internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0x4001f0c100) internal/poll/fd_unix.go:614 +0x250 net.(*netFD).accept(0x4001f0c100) net/fd_unix.go:172 +0x28 net.(*TCPListener).accept(0x400000f770) net/tcpsock_posix.go:148 +0x28 net.(*TCPListener).Accept(0x400000f770) net/tcpsock.go:297 +0x2c net/http.(*Server).Serve(0x4002189950, {0x5803230, 0x400000f770}) net/http/server.go:3059 +0x2cc net/http.(*Server).ListenAndServe(0x4002189950) net/http/server.go:2988 +0x84 net/http.ListenAndServe(...) net/http/server.go:3242 github.com/cometbft/cometbft/node.NewNodeWithContext.func1() github.com/cometbft/cometbft/node/node.go:1056 +0x128 created by github.com/cometbft/cometbft/node.NewNodeWithContext github.com/cometbft/cometbft/node/node.go:1053 +0xf64 goroutine 63 [IO wait]: internal/poll.runtime_pollWait(0xffff7df11538, 0x72) runtime/netpoll.go:306 +0xa0 internal/poll.(*pollDesc).wait(0x40021fe600?, 0x0?, 0x0) internal/poll/fd_poll_runtime.go:84 +0x28 internal/poll.(*pollDesc).waitRead(...) internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0x40021fe600) internal/poll/fd_unix.go:614 +0x250 net.(*netFD).accept(0x40021fe600) net/fd_unix.go:172 +0x28 net.(*TCPListener).accept(0x400135ed38) net/tcpsock_posix.go:148 +0x28 net.(*TCPListener).Accept(0x400135ed38) net/tcpsock.go:297 +0x2c golang.org/x/net/netutil.(*limitListener).Accept(0x40035c6960) golang.org/x/net/netutil/listen.go:63 +0x74 net/http.(*Server).Serve(0x4000316780, {0x58015b0, 0x40035c6960}) net/http/server.go:3059 +0x2cc github.com/cometbft/cometbft/rpc/jsonrpc/server.Serve({0x58015b0, 0x40035c6960}, {0x57dcf60, 0x40035be500}, {0x580a958, 0x40035c80d0}, 0x40035c2600) github.com/cometbft/cometbft/rpc/jsonrpc/server/http_server.go:62 +0x21c github.com/cometbft/cometbft/node.(*Node).startRPC.func3() github.com/cometbft/cometbft/node/node.go:1339 +0x40 created by github.com/cometbft/cometbft/node.(*Node).startRPC github.com/cometbft/cometbft/node/node.go:1338 +0x824 goroutine 116 [IO wait, 1841 minutes]: internal/poll.runtime_pollWait(0xffff7df11358, 0x72) runtime/netpoll.go:306 +0xa0 internal/poll.(*pollDesc).wait(0x4001f0c180?, 0x0?, 0x0)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, the main difference with sdk version is we modified the stores in Commit(), in the sdk version, I guess the assumption is the Store won't be mutated after loaded, that's why it don't need protection, we can try to fix the mutation itself.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1302
I have a different solution, WDYT?

@mmsqe mmsqe closed this Jan 23, 2024
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.

3 participants