Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a data race on write_validator_factory #5573

Merged
merged 2 commits into from
Jun 9, 2022
Merged

Fix a data race on write_validator_factory #5573

merged 2 commits into from
Jun 9, 2022

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Jun 8, 2022

PendingBootstrapStore is created early in session initialization, which performs a write and thus reads the write validator. This can race with setting the write validator on the thread which created the sync session, and tsan complains about it.

Moving the initialization to SyncSession's constructor ensures that it's set before we create the sync::Session.

@tgoyne tgoyne self-assigned this Jun 8, 2022
@cla-bot cla-bot bot added the cla: yes label Jun 8, 2022
PendingBootstrapStore is created early in session initialization, which
performs a write and thus reads the write validator. This can race with setting
the write validator on the thread which created the sync session, and tsan
complains about it.

Moving the initialization to SyncSession's constructor ensures that it's set
before we create the `sync::Session`.
@tgoyne tgoyne force-pushed the tg/tsan-failure branch from d4db8e7 to 58a03d9 Compare June 8, 2022 22:04
@tgoyne tgoyne requested a review from jbreams June 8, 2022 22:30
Copy link
Contributor

@jbreams jbreams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

CHANGELOG.md Outdated
@@ -6,6 +6,7 @@

### Fixed
* Fixed a segfault in sync compiled by MSVC 2022. ([#5557](https://github.com/realm/realm-core/pull/5557), since 12.1.0)
* Fix a data race when openg a flexible sync Realm (since v12.1.0).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openg -> opening

@tgoyne tgoyne merged commit deed94d into master Jun 9, 2022
@tgoyne tgoyne deleted the tg/tsan-failure branch June 9, 2022 06:00
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants