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

Initializing Realm from background thread causes data race warnings #8222

Closed
TomasLinhart opened this issue May 1, 2023 · 1 comment · Fixed by #8224
Closed

Initializing Realm from background thread causes data race warnings #8222

TomasLinhart opened this issue May 1, 2023 · 1 comment · Fixed by #8224

Comments

@TomasLinhart
Copy link

TomasLinhart commented May 1, 2023

How frequently does the bug occur?

Always

Description

Object._getProperties() and EmbeddedObject._getProperties() are annotated with @MainActor, but if you initialize Realm from a background thread. For example, using DispatchQueue.global().async. These methods will be called from the same thread that was used to initialize Realm.

It happens only if you build Realm as a debug build via Carthage, because you set SWIFT_STRICT_CONCURRENCY to complete.

image

image

I would either expect Realm.init to be on the main actor too or the methods not requiring the main actor.

Can you reproduce the bug?

Always

Version

v10.38.3

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 16.4

Build environment

Xcode version: 14.3
Dependency manager and version: Carthage - Locally built Debug build

@tgoyne
Copy link
Member

tgoyne commented May 1, 2023

Ah, those annotations are just incorrect.

@sync-by-unito sync-by-unito bot reopened this May 5, 2023
@sync-by-unito sync-by-unito bot closed this as completed May 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants