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

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 in Query Wrapper, Query execution :
(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(
at com.couchbase.lite.internal.CBLStatus.convertException(
at com.couchbase.lite.AbstractQuery.execute(
at com.couchbase.lite.OrderBy.execute(
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$
at android.os.AsyncTask$SerialExecutor$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: LiteCoreException{domain=1, code=10, msg=std::bad_alloc}
at Method)
at com.couchbase.lite.internal.core.C4Query.lambda$run$0(
at com.couchbase.lite.internal.core.-$$Lambda$C4Query$5opHAWSVpT7BAQeilhxNXw0sQDA.apply(Unknown Source:6)
at com.couchbase.lite.internal.core.C4NativePeer.withPeerThrows(
at com.couchbase.lite.AbstractQuery.execute(

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>=?)


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?