Skip to content

Conversation

simolus3
Copy link
Contributor

In the connectInternal() method used to establish a connection to the sync service, we await initialize(). That can be a problem when connect() is the first call on the database, because writing the schema also acquires the lock used to guard connectInternal().

This fixes the issue by awaiting initialize() in connect(), before acquiring the sync connect lock and calling initialize(). I've also added a test calling connect() immediately after opening the database to validate this.

This is the second time I get to fix this exact regression, yikes 😬 At least in Kotlin we've not seen too many concurrency issues after that though...

@simolus3 simolus3 merged commit 83b82c9 into main Apr 25, 2025
11 checks passed
@simolus3 simolus3 deleted the fix-connect-on-open branch April 25, 2025 10:34
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.

2 participants