Repository navigation
fix(datastore): synchronize in-memory routing datastore - #1890
Merged
tkircsi merged 1 commit intoJul 27, 2026
Merged
Conversation
This was referenced Jul 25, 2026
Signed-off-by: Konstantin Baltsat <[email protected]>
github-actions
Bot
force-pushed
the
fix/1886-mapdatastore-concurrency-dco
branch
from
July 25, 2026 12:17
8349f90 to
644330d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MapDatastorewithsync.MutexWrapQuery/Putregression test at the datastore construction boundaryRoot cause
The default datastore constructor returned a raw
github.com/ipfs/go-datastore.MapDatastore. That implementation is not thread-safe. Directory shares this datastore across routing components that can query and write concurrently, matching the reportedconcurrent map iteration and map writepanic inMapDatastore.Query.Synchronizing at construction covers every consumer of the shared in-memory datastore; locking only the failing query path would leave other direct readers and writers uncoordinated.
Fixes #1886
Validation
fatal error: concurrent map iteration and map writego test -race -count=10 ./safepassesgofmtpasses for both changed filesThe repository-native test could not be executed in the worker VM because it had Go 1.23.2 while
server/go.modrequires Go 1.26.5, and the environment could not fetch that toolchain/module graph. The new test is included so upstream CI can compile and exercise the production construction path.