fix: SessionStore race conditions and async initialization (WAPI-1118)#71
Open
chakra-guy wants to merge 1 commit intocyfrin/wapi-1116from
Open
fix: SessionStore race conditions and async initialization (WAPI-1118)#71chakra-guy wants to merge 1 commit intocyfrin/wapi-1116from
chakra-guy wants to merge 1 commit intocyfrin/wapi-1116from
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
840959f to
4ce2384
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).
4ce2384 to
fcf6205
Compare
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
Breaking API change and modified session persistence/concurrency behavior; issues here could impact session listing/deletion under load, though coverage was added for the new guarantees.
Overview
Fixes
SessionStoreinitialization and concurrency by making construction async-only and serializing master-list updates.SessionStorenow exposesawait SessionStore.create(kvstore)(constructor made private) which runs startup garbage collection to completion before the instance is used, and uses anasync-mutexto prevent lost updates inaddToMasterList/removeFromMasterListduring concurrentset/deletecalls.All apps/tests/load-tests/demos are updated to use the new async factory, and new unit tests cover GC completion on init and concurrent
setbehavior; changelog and core deps are updated accordingly.Written by Cursor Bugbot for commit fcf6205. This will update automatically on new commits. Configure here.