-
-
Notifications
You must be signed in to change notification settings - Fork 734
Description
The problem:
Sometimes saving parse objects using the save() function takes several minutes.
In those 2-15 minutes the save function will not return.
Background:
In our app, for each Class that we want to save to the servers, we create a class extending ParseObject, using an inheritance tree. For example:
Both class ParseDog and class ParseCat extends ParsePet, which in turn extends ParseObjectWrapper. Some classes like ParseNotification extends ParseObjectWrapper directly.
For users we use the built in ParseUser class.
We do all our work with parse in a closed parse module.
We have Objects which reference other objects (always from another class), we use reference arrays, and so on.
We do all relations as recommended in the parse documentation.
Other issues that might be worth mentioning:
- We had a big issue with ConcurrentModificationException. Eventually we had to use a read-write lock for all objects, so if we write 1 object, we don't read any object even if it is from a completely unrelated class.
- When running in debug mode, parse usually works very slow.
- The app is still in beta. So a load issue is unlikely. Yet, sometimes we get above the 30 calls / second limit at midnight, and then it drops back to almost zero.
- We use saveAll() a lot, but till 2 month ago we didn't, and we had the same problem back then too.
More about the problem:
- Usually, once it happens, it will happen from all devices for several hours and up to a day.
- Sometimes it will happen only for few devices / users. In those cases usually some objects will get saved normally while others won't, and the issue will remain for days.
- Using saveInBackground doesn't help. We tried and the callback function have never be called or it took several minutes.
- We don't have any issues with reading from the server.
- We tried to flatten the inheritance tree (remove the classes ParseObjectWrapper & ParsePet). This did not help.
Links to other bugs that we thought might be relevant:
- http://stackoverflow.com/questions/27051940/parse-uploading-data-sometimes-needs-forever-and-does-never-finish
- http://androidstackoverflow.blogspot.co.il/2014/07/android-sometimes-saveinbackground.html (less related as we use save and don't do 2 saves in the same time)
- As we use subclasses of subclass, this might be related:
http://stackoverflow.com/questions/31682495/subclassing-a-parseobject-subclass-android/31682925#31682925 (but in our case we don't register classes that are inherited + we tried removing the inheritance and it didn't help)