Error from couchbase lite 2.7.1 (java) CE

Hi There,
I got this error to run java application on Linux to get data from couchbase lite 2.7.1 CE, please let me know if you have any suggestions.

CouchbaseLiteException{CouchbaseLite,10,‘std::bad_alloc’}
at com.couchbase.lite.internal.CBLStatus.convertException(CBLStatus.java:92)
at com.couchbase.lite.internal.CBLStatus.convertException(CBLStatus.java:46)
at com.couchbase.lite.AbstractQuery.check(AbstractQuery.java:297)
at com.couchbase.lite.AbstractQuery.execute(AbstractQuery.java:133)
at com.couchbase.lite.Limit.execute(Limit.java:27)

@priya.rajagopal can you please direct it to the right person, this is under an incorrect category

Duplicate post already addressed here - Couchbase lite java 2.8.1 community

@priya.rajagopal, It’s different issue

Is this still an issue in 2.8.1.1 ? If so, please share complete stack trace along with more details such as the query

(Also FFR - tag CBL related issues as “mobile”. We have java SDKs for server apps).

@priya.rajagopal I got this log/crash when we deployed cblite2.8.1.1 into linux server:

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007fdee94b256e, pid=105751, tid=0x00007fdf1554b700

JRE version: OpenJDK Runtime Environment (8.0_272-b10) (build 1.8.0_272-b10)

Java VM: OpenJDK 64-Bit Server VM (25.272-b10 mixed mode linux-amd64 compressed oops)

Problematic frame:

C [libLiteCore.so+0x5656e]

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try “ulimit -c unlimited” before starting Java again

If you would like to submit a bug report, please visit:

https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%207&component=java-1.8.0-openjdk

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

@priya.rajagopal, any idea for this crash? It has been happening often on our linux server. Thanks!
Since it’s the issue from cblite CE 2.8.1.1, please let me know if I should have created new incident.

Tagging @blake.meike

I think we will need more details on exactly what you were attempting to do within your app that triggered this crash. And a full stack stack/thread dump .

@priya.rajagopal I can’t upload dump file here, any alternative?

Priya is exactly right: there is definitely not enough information, here, so that we can analyze the problem.

We could use the stack dump from the failure. It doesn’t have to be 64 point type and bold… .just the entire native stack dump.

Better yet, if we had instructions for reproducing it, that would be a huge help.

@blake.meike how can I send you the dump file? It doesn’t allow me to upload file here due to “new users”

Many people use Gists: https://docs.github.com/en/free-pro-team@latest/github/writing-on-github/creating-gists

There are other ways, as weil… https://livablesoftware.com/tools-share-beautiful-code-snippets/

@blake.meike https://gist.github.com/minruliao/f996ae3b6a5915f379e9638adffd18ff

@blake.meike, any update for this issue?

The stack dump that you provided suggests that the static native method in C4Query:

private static native long init(long db, String expression) throws LiteCoreException;

… is being called with 0 as its first argument.

As far as I can tell, while that was a bug in v 2.7, it not possible in the 2.8 release. C4Query.createQuery gets that argument from a call to getPeer(), which cannot return 0.

Could you make sure that you are using v2.8.1?

@blake.meike yes, we are using cblite CE 2.8.1.1

Got it. This is pretty strange.

I do not see how the code can produce the error that it seems you are seeing (0 pointer passed to the native method). getPeer() cannot return 0.

Can you get me a logcat from the a minute or so before the error occurs, up until just after it happens?

@blake.meike any instruction to create/find cblite logcat on linux? Thanks.

Ugg. My mistake. I confused this with another query about Android.

If you can get output from the console logger, that would be great. Please be sure to set LogLevel to DEBUG and the logged domains to ALL_DOMAINS.

If this is running in Tomcat, the catalina log would be helpful, too…

@blake.meike I use the following codes to log, is it ok?
final File path = new File(recordsConfig.getDataHome() + “/producer/logs”);
Database.log.getFile().setConfig(new LogFileConfiguration(path.toString()));
Database.log.getFile().setLevel(LogLevel.INFO);