Skip to content

Fix concurrent map races in Statelet, collector, and session cache - #108

Open
alexis779 wants to merge 1 commit into
viant:masterfrom
alexis779:reproduce-column-names-map-race
Open

Fix concurrent map races in Statelet, collector, and session cache#108
alexis779 wants to merge 1 commit into
viant:masterfrom
alexis779:reproduce-column-names-map-race

Conversation

@alexis779

@alexis779 alexis779 commented Sep 9, 2026

Copy link
Copy Markdown

Summary

  • Locks shared maps that could fatal with concurrent map iteration and map write (and the read/write variant) under parallel reads.
  • Statelet._columnNames is the production path: CloneForSummary ranged the map while Add wrote it. Collector parent indexes, PredicateRegistry, session cache JSON, and Types.Lookup had the same shape.
  • Each site has a 3s stress test that crashed on the unlocked tree and now survives.

Fixes #107.

Test plan

  • go test -timeout 10s -count=1 -run TestStateletCloneForSummaryConcurrentColumnNames ./view/ — crashed before the lock, passes after 3s
  • go test -timeout 10s -count=1 -run TestCollectorConcurrentParentValuePositions ./view/
  • go test -timeout 10s -count=1 -run TestPredicateRegistryConcurrentLookupAndAdd ./view/extension/
  • go test -timeout 10s -count=1 -run TestSessionMarshalJSONConcurrentCachePut ./service/session/
  • go test -timeout 10s -count=1 -run TestDataUnitConcurrentSliceIndex ./service/executor/expand/
  • go test -timeout 10s -count=1 -run TestTypesConcurrentLookupAndPut ./view/state/
  • Existing collector/bootstrap tests still pass

Statelet column names, collector parent indexes, predicate registry, and session cache JSON could fatal with concurrent map iteration or write.
@alexis779
alexis779 force-pushed the reproduce-column-names-map-race branch from 97521a2 to 3574859 Compare September 9, 2026 05:02
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.

Bug: concurrent map iteration and map write in Statelet.CloneForSummary

1 participant