You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am also getting this error occasionally. I think it is a race condition in ModelAdapter.getModelSaver(). The ModelAdapter lazily initializes an instance of ModelSaver without synchronization here:
If multiple threads call getModelSaver() concurrently, it is possible for one thread to get (and attempt to use) the modelSaver instance before setModelAdapter(this) has been called on it, leading to the NPE.
This seems to have been (kind of) fixed in 5.0.0-alpha2. It could result in multiple instances of ModelSaver being used, which would solve this crash but introduce the possibility of synchronization errors, since ModelSaver has several @Synchronized functions:
It is not trivial to upgrade to the new library, and it is also risky to upgrade to a new major "dot zero alpha" version.
As a workaround, you could call .getModelSaver() on each ModelAdapter immediately after initializing DbFlow, as long as you can ensure no other threads are calling save() while this is happening.
DBFlow Version: 4.2.4
Bug or Feature Request: Attempt to invoke virtual method '....RetrievalAdapter.getModelClass()' on a null object reference
Description:
I'm getting the exception occasionally in production. Not sure why this fails only occasionally. Anyone have an idea?
The text was updated successfully, but these errors were encountered: