__next_prime overflow exception

Hello,
when I’m using couchbase lite (free version), after some time, ANY cache query start throwing __next_prime overflow exception.
for example:

  • when I create N1QL:
    database.createQuery(query)
    I get exception
[cache] Error : com.couchbase.lite.CouchbaseLiteException: __next_prime overflow
 (CouchbaseLite Android v3.0.5-1@31 (CE/release, Commit/unofficial@3e782b88ecec Core/3.0.5 (1) 
at 2022-10-19T18:22:13.132643Z) on Java; Android 12; M2101K9G)
at com.couchbase.lite.N1qlQuery.prepQueryLocked(N1qlQuery.java:54)
at com.couchbase.lite.AbstractQuery.getC4QueryLocked(AbstractQuery.java:206)
at com.couchbase.lite.AbstractQuery.getC4Query(AbstractQuery.java:186)
at com.couchbase.lite.N1qlQuery.compile(N1qlQuery.java:57)
at com.couchbase.lite.AbstractDatabase.createQuery(AbstractDatabase.java:656)
at com.couchbase.lite.Database.createQuery(Database.java:30)
...
  • Another situation using query builder, on query.execute()
 Query query = .....
ResultSet resultSet = query.execute();
[DefaultDispatcher-worker-1] Error : com.couchbase.lite.CouchbaseLiteException: __next_prime overflow
(CouchbaseLite Android v3.0.5-1@31 (CE/release, Commit/unofficial@3e782b88ecec Core/3.0.5 (1)
 at 2022-10-19T18:22:13.132643Z) on Java; Android 12; M2101K9G)
at com.couchbase.lite.BuilderQuery.prepQueryLocked(BuilderQuery.java:83)
at com.couchbase.lite.AbstractQuery.getC4QueryLocked(AbstractQuery.java:206)
at com.couchbase.lite.AbstractQuery.execute(AbstractQuery.java:101)
at com.couchbase.lite.Where.execute(Where.java:30)
...

Info:

  • Phone: xiaomi mi 11 lite
  • System : Andriod 12
  • Lib: com.couchbase.lite:couchbase-lite-android:3.0.5
  • I’m using kotlin coroutines to make async queries

Is the app also crashed? and Is there a tombstone file? Basically, I’m trying to see if we could get more info about what is causing the overflow error.

Also does the issue happen only on a specific query? Can this issue be reproduced on an emulator? Can this issue be reproduced by running the same query in a loop for some time? Basically, we need something that we can use to reproduce the issue.

If you have access to the device on which the error occurs, you may be able to pull the tombstone files with the adb command:

adb bugreport

I’m not sure if this helps this case - but here’s a stackoverflow issue for that exception with a possible solution : c++ - __next_prime symbol undefined - Stack Overflow