RJS-2784 Fix callback crashes when reloading with React Native#7963
RJS-2784 Fix callback crashes when reloading with React Native#7963danieltabacaru wants to merge 1 commit intomasterfrom
Conversation
| static constexpr bool cancel_subscription_notifications = false; | ||
| shutdown_and_wait(cancel_subscription_notifications); |
There was a problem hiding this comment.
Shouldn't this be sending OperationCancelled to any subscription change notifications?
There was a problem hiding this comment.
my reasoning was to guard against sub.get_state_change_notification().get_async() use cases.
There was a problem hiding this comment.
Yes, that needs to invoke the completion handler. Every Future must always be fulfilled.
There was a problem hiding this comment.
but the completion handler may be gone and crash (pretty much the issue with every handler/callback).
There was a problem hiding this comment.
The JS SDK needs to either ensure that App is destroyed before the callback handlers or take responsibility for discarding OperationCancelled calls. The Promise being destroyed without being fulfilled will invoke the completion handler with a BrokenPromise error if we don't explicitly fulfill it.
There was a problem hiding this comment.
I see. I will revert this specific change then cc @gagik
Pull Request Test Coverage Report for Build daniel.tabacaru_887Details
💛 - Coveralls |
ac499d0 to
d3fa720
Compare
e347766 to
d3fa720
Compare
What, How & Why?
See realm/realm-js#6579 and realm/realm-js#6824
When hot reloading with React Native and using sync session connection change callbacks, the app crashes. This is because the callbacks are not cleared and get called. This PR unregisters all callbacks set through the SyncSession when the SyncManager is destroyed as a result of the App being destroyed.
Fixes realm/realm-js#6579.
☑️ ToDos
bindgen/spec.yml, if public C++ API changed