Skip to content
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

RealmResults iterator throw ArrayIndexOutOfBoundsException in concurrent case #7892

Open
sherardxu opened this issue May 28, 2024 · 3 comments

Comments

@sherardxu
Copy link

How frequently does the bug occur?

Sometimes

Description

I'm using toFlow to cache in ViewModel and when I read the cache in multiple scenes, sometimes an exception is thrown.

Stacktrace & log output

java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
	at java.util.ArrayList.add(ArrayList.java:468)
	at io.realm.internal.OsSharedRealm.addIterator(OsSharedRealm.java:515)
	at io.realm.internal.OsResults$Iterator.<init>(OsResults.java:68)
	at io.realm.OrderedRealmCollectionImpl$RealmCollectionIterator.<init>(OrderedRealmCollectionImpl.java:531)
	at io.realm.OrderedRealmCollectionImpl.iterator(OrderedRealmCollectionImpl.java:221)
	at io.realm.RealmResults.iterator(RealmResults.java:71)

Can you reproduce the bug?

Sometimes

Reproduction Steps

No response

Version

10.18.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

Android

Build environment

Android Studio version: 2023.3.1 Patch 1
Android Build Tools version: 34.0.0
Gradle version: 8.6

Copy link

sync-by-unito bot commented May 28, 2024

➤ PM Bot commented:

Jira ticket: RJAVA-1263

@caeduk
Copy link

caeduk commented Jun 15, 2024

Happens quite a lot on my project as well.
Encryption: OFF

@caeduk
Copy link

caeduk commented Jun 15, 2024

this should probably be a synchronised list?

final List<WeakReference<OsResults.Iterator>> iterators = new ArrayList<>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants