-
Notifications
You must be signed in to change notification settings - Fork 165
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
NoSuchTable thrown from import_copy_of() #3761
Comments
The call stack indicates an attempt to "handover" a table from transaction A to B but at a point in time, where A is no longer valid. |
Since it happens on the notifier thread, one may speculate if perhaps high CPU load has delayed the thread in which we want to import to a point where the stuff we want to import is no longer valid. If so, this would point to a bug in either OS or JS violating the constraints for use of "import_copy_of". |
Cannot reproduce. Closing, presumed fixed by #3749. |
Possibly related to https://github.com/realm/realm-object-store/issues/1071 |
I think I may have spotted what could be causing this. |
Awesome! Waiting anxiously. |
When a new ResultsNotifier is created, it copies the query from the source Results to the notifier Transaction on the worker thread without any locking involved. This is actually almost safe, but there's a TOCTOU race at https://github.com/realm/realm-core/blob/master/src/realm/object-store/impl/results_notifier.cpp#L219 and we'll hit this error if the source Realm is invalidated between the check and when we obtain the table key inside import_copy_of(). The timing required for this is very tight, which explains why it's a pretty rare crash. The code currently is still very structured around both the idea that creating a SharedGroup is an expensive operation and having explicit handover objects. It seems pretty easy to fix this and simplify the code a little by adjusting it to better take advantage of how things work now. |
This was originally reported in issue #3701, but it's a different error.
Copy of original report (by @ironage ):
Stack trace:
Code:
The text was updated successfully, but these errors were encountered: