CouchbaseLiteException {CouchbaseLite,10,'std::bad_alloc}

HI,
I’m using CBL v2.8.4.

I am seeing the following error in few devices one of the device

Samsung Tablet Device

Model: (SM-T595)

RAM free: 1.9 GB

Disk free: 7.14 GB

Error:

Error in Query Wrapper, Query execution :
CouchbaseLiteException{CouchbaseLite,10,‘std::bad_alloc
(CouchbaseLite Android v2.8.4-7 (CE/release, Commit/cb6ed4801c@c65a5127e818 Core/2.8.4 (7) at 2021-02-15T20:41:26.267Z) on Java; Android 10; SM-T595)’}
at com.couchbase.lite.internal.CBLStatus.toCouchbaseLiteException(CBLStatus.java:96)
at com.couchbase.lite.internal.CBLStatus.convertException(CBLStatus.java:45)
at com.couchbase.lite.AbstractQuery.execute(AbstractQuery.java:141)
at com.couchbase.lite.OrderBy.execute(OrderBy.java:32)
at com.rba.databases.couchbase.DeQuery.execute(DeQuery.kt:700)
at com.rba.databases.couchbase.DeQuery.access$execute(DeQuery.kt:30)
at com.rba.databases.couchbase.DeQuery$ProcessQueryTask.doInBackground(DeQuery.kt:1780)
at com.rba.databases.couchbase.DeQuery$ProcessQueryTask.doInBackground(DeQuery.kt:1756)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: LiteCoreException{domain=1, code=10, msg=std::bad_alloc}
at com.couchbase.lite.internal.core.C4Query.run(Native Method)
at com.couchbase.lite.internal.core.C4Query.lambda$run$0(C4Query.java:60)
at com.couchbase.lite.internal.core.-$$Lambda$C4Query$5opHAWSVpT7BAQeilhxNXw0sQDA.apply(Unknown Source:6)
at com.couchbase.lite.internal.core.C4NativePeer.withPeerThrows(C4NativePeer.java:79)
at com.couchbase.lite.internal.core.C4Query.run(C4Query.java:58)
at com.couchbase.lite.AbstractQuery.execute(AbstractQuery.java:135)

Query:
SELECT fl_result(_doc.key), fl_result(fl_root(_doc.body)) FROM kv_default AS _doc WHERE (((fl_value(_doc.body, ‘type’) = ‘_th_data’ AND fl_value(_doc.body, ‘team._id’) = ‘1234567890’) AND fl_value(_doc.body, ‘isDeleted’) = fl_bool(0)) AND fl_value(_doc.body, ‘status’) = ‘ACTIVE’) AND (_doc.flags & 1 = 0) ORDER BY fl_value(_doc.body, ‘name’)

4|0|0| SEARCH TABLE kv_default AS _doc USING INDEX DataIndex (<expr>=? AND <expr>=? AND <expr>=? AND <expr>=?)

{"ORDER_BY":[[".name"]],"WHAT":[["._id"],["."]],"WHERE":["AND",["AND",["AND",["=",[".type"],"_th_data"],["=",[".team._id"],"1234567890"]],["=",[".isDeleted"],false]],["=",[".status"],"ACTIVE"]]}

while executing above query particular error occurred,
Please help me to fix the particular error.
Thanks in Advance

You haven’t said what CBL platform you are using. It looks like Java for Android?

It appears that the native library, LiteCore, is failing to allocate memory.

I will ask one of our LiteCore devs to comment.

Agree with Blake’s assessment: the program fails to find memory. What if you try to restart the app and try the query afresh?

Thanks for your response,
I tried restart the app and reinstalling app in both the cases the problem remain the same

we are using “com.couchbase.lite:couchbase-lite-android:2.8.4” platform in the particular application,
we are working on java and kotlin android application

How big is your database? Could you put a “LIMIT 10” to the query?