fix: SessionStore race conditions and async initialization (WAPI-1118)#71
Merged
chakra-guy merged 1 commit intomainfrom Feb 27, 2026
Merged
fix: SessionStore race conditions and async initialization (WAPI-1118)#71chakra-guy merged 1 commit intomainfrom
chakra-guy merged 1 commit intomainfrom
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
4ce2384 to
fcf6205
Compare
Replace fire-and-forget garbage collection with an async factory method (SessionStore.create) that completes GC before the store is usable. Add mutex protection around master list read-modify-write operations to prevent concurrent session set/delete from corrupting the list. BREAKING: SessionStore constructor is now private. Use await SessionStore.create(kvstore) instead of new SessionStore(kvstore).
fcf6205 to
90bf894
Compare
wenfix
approved these changes
Feb 27, 2026
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
Fixes race conditions in
SessionStoreand replaces fire-and-forget garbage collection with proper async initialization.SessionStoreconstructor is now private; useawait SessionStore.create(kvstore)insteadSessionStore.create()runs garbage collection to completion before returningaddToMasterList,removeFromMasterList)Note: This PR is based on
cyfrin/wapi-1116and should be merged after PR #70.Jira
Test plan
new SessionStore(kvstore)call sites updated toawait SessionStore.create(kvstore)Note
Medium Risk
Medium risk because it changes the
SessionStoreinstantiation API (breaking) and modifies persistence semantics around master list updates and startup garbage collection, which can affect session resumption and cleanup timing across clients.Overview
Fixes
SessionStorerace conditions and startup GC timing. TheSessionStoreconstructor is now private and callers must useawait SessionStore.create(kvstore), which runs garbage collection to completion before the store is used.Master-list updates are now mutex-protected to avoid lost entries under concurrent
set/deleteoperations, with new unit tests covering GC-before-use and concurrent writes; all apps/tests were updated to the async factory API andasync-mutexwas added as a core dependency.Written by Cursor Bugbot for commit 90bf894. This will update automatically on new commits. Configure here.