Skip to content

RCORE-2135 Make AsyncOpenTask wait until all pending subscriptions finish bootstrapping #7723

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

Merged
merged 4 commits into from
Jun 10, 2024

Conversation

danieltabacaru
Copy link
Collaborator

@danieltabacaru danieltabacaru commented May 23, 2024

What, How & Why?

Opening an FLX realm asynchronously may not wait to download all data. We changed it so the asynchronous task now waits until all subscriptions finish bootstrapping.

Fixes #7720.

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • [ ] C-API, if public C++ API changed
  • [ ] bindgen/spec.yml, if public C++ API changed

Copy link

coveralls-official bot commented May 27, 2024

Pull Request Test Coverage Report for Build daniel.tabacaru_849

Details

  • 70 of 73 (95.89%) changed or added relevant lines in 2 files are covered.
  • 129 unchanged lines in 17 files lost coverage.
  • Overall coverage decreased (-0.05%) to 90.94%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/object-store/sync/async_open_task.cpp 12 15 80.0%
Files with Coverage Reduction New Missed Lines %
src/realm/sort_descriptor.cpp 1 94.06%
src/realm/sync/instructions.hpp 1 76.03%
src/realm/sync/network/websocket.cpp 1 71.79%
src/realm/util/serializer.cpp 1 90.43%
test/test_dictionary.cpp 1 99.83%
src/realm/query_expression.cpp 2 86.62%
src/realm/sync/instruction_applier.cpp 3 68.01%
src/realm/sync/network/http.hpp 3 82.27%
src/realm/table.cpp 3 90.37%
src/realm/alloc_slab.cpp 4 90.56%
Totals Coverage Status
Change from base Build 2402: -0.05%
Covered Lines: 214531
Relevant Lines: 235904

💛 - Coveralls

Copy link
Member

@nicola-cab nicola-cab left a comment

Choose a reason for hiding this comment

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

it looks good in regard to the new logic, but I think we should remove the rerun on launch flag, don't we?

@@ -108,15 +108,21 @@ void AsyncOpenTask::unregister_download_progress_notifier(uint64_t token)
m_session->unregister_progress_notifier(token);
}

void AsyncOpenTask::attach_to_subscription_initializer(AsyncOpenCallback&& callback,
std::shared_ptr<_impl::RealmCoordinator> coordinator,
bool rerun_on_launch)
Copy link
Member

Choose a reason for hiding this comment

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

So it seems we are going to ignore the rerun_on_launch flag. Don't we have to remove it from the configuration.
bool rerun_init_subscription_on_open{false}; ... also isn't this going to be a breaking change for the SDKs? Am I wrong?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So it seems we are going to ignore the rerun_on_launch flag.

Not entirely. We do use it in the RealmCoordinator to decide if the subscription initializer callback is invoked or not.

@nicola-cab nicola-cab self-requested a review May 28, 2024 09:19
Copy link
Member

@nicola-cab nicola-cab left a comment

Choose a reason for hiding this comment

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

OK, I tested it and it looks good! Approved. But we have an address sanitizer issue:
==1892==ERROR: AddressSanitizer: access-violation on unknown address 0x0066b552a870 (pc 0x0066b552a870 bp 0x000000000000 sp 0x0066b5528128 T0)

@danieltabacaru
Copy link
Collaborator Author

OK, I tested it and it looks good! Approved. But we have an address sanitizer issue: ==1892==ERROR: AddressSanitizer: access-violation on unknown address 0x0066b552a870 (pc 0x0066b552a870 bp 0x000000000000 sp 0x0066b5528128 T0)

yeah, I am looking into it. All the other tasks fail because the realm file is accessed from a different thread.

@danieltabacaru danieltabacaru force-pushed the dt/async_open_task_fix branch from 6a96bed to 0870c47 Compare June 10, 2024 09:07
@danieltabacaru danieltabacaru merged commit b6452b9 into master Jun 10, 2024
39 checks passed
@danieltabacaru danieltabacaru deleted the dt/async_open_task_fix branch June 10, 2024 10:17
@github-actions github-actions bot mentioned this pull request Jun 17, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 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.

AsyncOpenTask does not always download all data
3 participants