Bidirectional links Caused slowness when parsing collection changeset
See original GitHub issueGoal
I think I’ve found a bug that makes Realm freeze while trying to execute transactions to update data.
Results
My schema worked fine in Realm 2.3.0, but it doesn’t seem to work well in Realm 3.1.3.
Steps & Code to Reproduce
I’ve created a simple app to reproduce the bug: https://github.com/jpmcosta/RealmTestProject/tree/47b091215e2517ae337b88f6a5aeb597edf6542d:
- run the app;
- click on the FABs and on the items in the list;
- example: click 5 times on the left FAB, 5 times on right FAB, and then click once or twice on one of the items in the list.
- the app will eventually freeze and will have to be force closed.
Details of the app:
- left FAB will create a Filter, replicating my app’s use case (2 transactions):
- first, updates the data of a temporary Filter;
- then, copies the temporary Filter data to the actual Filter.
- right FAB will create an Item for every Feed (1 transaction);
- clicking on the items in the list (Filters) will update their
isEnabled
value (1 transaction).
Version of Realm and tooling
Realm version(s): 3.1.3
Android version: 5.1.1 (22)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:18 (13 by maintainers)
Top Results From Across the Web
A Short History of Bi-Directional Links - Maggie Appleton
We set up all these single-direction paths, trying to signal relevance and context, only to have the other side completely ignore our efforts....
Read more >Drools Expert User Guide - Red Hat on GitHub - JBoss.org
A Knowledge Base is what we call our collection of compiled definitions, such as rules and ... To facilitate this, Drools supports the...
Read more >Hibernate / "absolutely necessary with bi-directional links"?
In summary, from my reading of the docs it is not absolutely necessary, but failing to add the inverse-side entity to the collection...
Read more >Drupal 7 module for parse some sites to entities - gists · GitHub
Drupal 7 module for parse some sites to entities. GitHub Gist: instantly share code, notes, and snippets.
Read more >US7069497B1 - System and method for applying a partial page ...
A system and method for applying a partial page change to a browser page formatted according to Hypertext Markup Language (HTML).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was trying to figure out if there was an infinite loop or not. I’ve modified the test app to run multiple tests on different graphs, but with the same number of objects. Here: https://github.com/jpmcosta/RealmTestProject/tree/cdd686001d5293a1ee3ab7b43ded542ea2b89b0d
The test is simply:
I’ve tried to remove
parentFeed
fromItem
, to see the impact it might have, and I found that ifItem
has aparentFeed
object, the testing times jump from a maximum of ~8000ms to a maximum of ~70000ms.I’ve run tests 1000+ times, with different
OBJECT_COUNT
, and indeed it doesn’t seem to exist an infinite loop, just really slow transaction times.With 10
Apps
, 10Feeds
, 10Items
, no repeated links, and 3Filters
pointing toApp#0
, these were some of my results:For the specific case here, the
Filter
actually only has a single direction link to theApp
. And changeFilter.isEnabled
should effect otherFilter
objects in the collection. I think that is something should be optimized in our parsing. But I don’t have too much ideas right now.