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

fix(share/availability): add missing protection for autobatch #3988

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

walldiss
Copy link
Member

@walldiss walldiss commented Dec 9, 2024

Initially reported as panic by @Wondertan

fatal error: concurrent map iteration and map write goroutine 424607 [running]: [github.com/ipfs/go-datastore/autobatch.(*Datastore).Flush(0xc0015ff300](https://github.com/ipfs/go-datastore/autobatch.(*Datastore).Flush(0xc0015ff300), {0x3aacc20, 0xc00bb3b340}) /go/pkg/mod/github.com/ipfs/[email protected]/autobatch/autobatch.go:108 +0xa5 [github.com/ipfs/go-datastore/autobatch.(*Datastore).Put(...)](https://github.com/ipfs/go-datastore/autobatch.(*Datastore).Put(...)) /go/pkg/mod/github.com/ipfs/[email protected]/autobatch/autobatch.go:67 [github.com/celestiaorg/celestia-node/share/availability/light.(*ShareAvailability).SharesAvailable(0xc00050ba40](https://github.com/celestiaorg/celestia-node/share/availability/light.(*ShareAvailability).SharesAvailable(0xc00050ba40), {0x3aacc20, 0xc00bb3b340}, 0xc00694c180) /src/share/availability/light/availability.go:154 +0xab9 [github.com/celestiaorg/celestia-node/das.(*DASer).sample(0xc0014da1a0](https://github.com/celestiaorg/celestia-node/das.(*DASer).sample(0xc0014da1a0), {0x3aacc20, 0xc00bb3b340}, 0xc00694c180) /src/das/daser.go:171 +0xc9 [github.com/celestiaorg/celestia-node/das.(*worker).sample(0xc00bdb6480](https://github.com/celestiaorg/celestia-node/das.(*worker).sample(0xc00bdb6480), {0x3aacbb0, 0xc002286a00}, 0x2540be4000, 0xc00fa7feff?) /src/das/worker.go:121 +0xe2 [github.com/celestiaorg/celestia-node/das.(*worker).run(0xc00bdb6480](https://github.com/celestiaorg/celestia-node/das.(*worker).run(0xc00bdb6480), {0x3aacbb0, 0xc002286a00}, 0x2540be4000, 0xc0018fa3f0) /src/das/worker.go:81 +0x254 [github.com/celestiaorg/celestia-node/das.(*samplingCoordinator).runWorker.func1()](https://github.com/celestiaorg/celestia-node/das.(*samplingCoordinator).runWorker.func1()) /src/das/coordinator.go:112 +0x68 created by [github.com/celestiaorg/celestia-node/das.(*samplingCoordinator).runWorker](https://github.com/celestiaorg/celestia-node/das.(*samplingCoordinator).runWorker) in goroutine 560 /src/das/coordinator.go:110 +0x317

The panic was caused by concurrent access to autobatch datastore due to lack of sync protection on Flush call. This PR adds missing mutex protection for Flush call, as well as Delete, which also had protection missing .

@walldiss walldiss self-assigned this Dec 9, 2024
@cristaloleg cristaloleg added the kind:fix Attached to bug-fixing PRs label Dec 9, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.51%. Comparing base (2469e7a) to head (c8fb594).
Report is 403 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3988      +/-   ##
==========================================
+ Coverage   44.83%   45.51%   +0.68%     
==========================================
  Files         265      308      +43     
  Lines       14620    21995    +7375     
==========================================
+ Hits         6555    10012    +3457     
- Misses       7313    10912    +3599     
- Partials      752     1071     +319     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@cristaloleg cristaloleg left a comment

Choose a reason for hiding this comment

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

sgtm

@Wondertan Wondertan merged commit 250c129 into celestiaorg:main Dec 9, 2024
29 of 31 checks passed
@Wondertan Wondertan deleted the protect-flush-in-autobatch branch December 9, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:fix Attached to bug-fixing PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants