Skip to content

Conversation

@Veenoway
Copy link

Bug Fix

Problem

The setSession method in MultisynqRoot component had a race condition when called multiple times rapidly, potentially creating multiple sessions without proper cleanup.

Solution

Added error handling and session validation in setSession:

  • Wrapped session creation in try/catch block
  • Added check to ensure only intended session is stored in nextSessionRef
  • Clean up abandoned sessions by calling leave() if another session was created in the meantime

Changes

  • Added try/catch block around createMultisynqSession(args)
  • Added validation check if (nextSessionRef.current === null)
  • Added cleanup call newSession.leave() for abandoned sessions

Manual Testing

Verified that concurrent setSession calls don't create session leaks.

Breaking Changes

None - this is a backwards-compatible bug fix.

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.

1 participant