Skip to content

Fix a crash that may occur when resolving a thread-safe reference - #8722

Open
PoltoraIvana wants to merge 3 commits into
realm:masterfrom
PoltoraIvana:patch-1
Open

Fix a crash that may occur when resolving a thread-safe reference#8722
PoltoraIvana wants to merge 3 commits into
realm:masterfrom
PoltoraIvana:patch-1

Conversation

@PoltoraIvana

Copy link
Copy Markdown

In some cases, as per documentation, resolveThreadSafeReference can return nil. It usually happens in highly-concurrent contexts. Checking for nil fixes this crash

In some cases, resolveThreadSafeReference: can return nil. Usually it happens in highly-concurrent contexts. This can lead to a crash
@aehlke

aehlke commented Nov 26, 2024

Copy link
Copy Markdown

Who will review and merge this now that Realm is dead?

@PoltoraIvana

Copy link
Copy Markdown
Author

I thought there are some maintainers that are left?
Overall, we had this problem in our codebase, it was fixed like that and the problem was fixed with it as well

@aehlke

aehlke commented Dec 1, 2024

Copy link
Copy Markdown

@tgoyne hi - can we get some community members authorized to merge PRs? Thank you

@tgoyne

tgoyne commented Dec 2, 2024

Copy link
Copy Markdown
Member

Reporting an error here is incorrect. The TSR resolving to nil means that the object was deleted in between observe() being called and the notifier being set up, and we can just report that to the block.

@aehlke

aehlke commented Dec 3, 2024

Copy link
Copy Markdown

I believe you can mitigate this crash by putting all writes on the same global actor, per realm file

@PoltoraIvana

PoltoraIvana commented Dec 3, 2024

Copy link
Copy Markdown
Author

I believe you can mitigate this crash by putting all writes on the same global actor, per realm file

that's an option, yes, but for us, we still have realm observations on queue, so we would need to migrate to take advantage of actors.

@aehlke

aehlke commented Dec 3, 2024

Copy link
Copy Markdown

Yes, I migrated all my Realm usage to actors to resolve crashing instability issues. I recommend it.

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.

4 participants