-
Notifications
You must be signed in to change notification settings - Fork 172
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
Progress notifiers are called after download is complete when opening a synced realm #4919
Comments
Looking at this, I can see what the issue is. When realm-core/src/realm/object-store/sync/async_open_task.cpp Lines 42 to 45 in 7d65a82
Which then means that we can't unregister the progress notifier from the SDK because realm-core/src/realm/object-store/sync/async_open_task.cpp Lines 85 to 89 in 7d65a82
We should find a way to ensure that all progress notifiers registered on the AsyncOpenTask are unregistered by the time it's resolved. One option is to keep a hashset of tokens and just call @tgoyne let me know if that makes sense to you or if there's a better/less naive way to do it. |
It should just be a vector of tokens and not some more complicated data structure, but otherwise makes sense to me. In the other SDKs we're probably currently soft-leaking progress notifiers in a way that just doesn't crash, but progress notifiers added to an async open shouldn't be firing for any progress after that open completes. |
One .NET user reported a native crash just after opening a synced realm (ticket). We figured out this is happening because a managed handle for progress notifiers is being called after being freed. The handle is freed after the download completion is called and the synced realm is opened. We expect that the progress notifiers would be deregistered once the
AsyncOpenTask
is resolved.For context, we are calling
AsyncOpenTask::register_download_progress_notifier
withis_streaming: false
, so we expect that once the task is resolved, all the data download should have been completed.The text was updated successfully, but these errors were encountered: