Delta Sync Warnings and Crashes

Hi

I am busy testing delta sync capability on android, I am seeing the following behavior, can anyone advise if this is normal?

We have the following versions:
Couchbase lite android: 3.2.0
Couchbase server: Couchbase Server Enterprise Edition 7.1.4 build 3601
Sync Gateway: Couchbase Sync Gateway/3.0.4(13;fe16b93) EE
Android Version: 11 (however tested on multiple versions)
Replicator: Push Pull Continuous Replicator

1) A huge increase in logs since enabling delta sync, is this to be expected? They have these tags CouchbaseLite/NETWORK, CouchbaseLite/REPLICATOR, CouchbaseLite/DATABASE

2) The following warning happen after most queries, does anyone know what it could mean, as far as I can tell all queries are still working as expected.

[JAVA] C4Query@0xb400006d924cb180: Expected this peer to have been closed previously
                                                                                                    java.lang.Exception: At: 
                                                                                                    	at com.couchbase.lite.internal.core.C4NativePeer.logCall(C4NativePeer.java:253)
                                                                                                    	at com.couchbase.lite.internal.core.C4NativePeer.releasePeer(C4NativePeer.java:216)
                                                                                                    	at com.couchbase.lite.internal.core.C4Query.closePeer(C4Query.java:124)
                                                                                                    	at com.couchbase.lite.internal.core.C4Query.finalize(C4Query.java:115)
                                                                                                    	at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:291)
                                                                                                    	at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:278)
                                                                                                    	at java.lang.Daemons$Daemon.run(Daemons.java:139)
                                                                                                    	at java.lang.Thread.run(Thread.java:923)
                                                                                                    Caused by: java.lang.Exception: Created at:
                                                                                                    	at com.couchbase.lite.internal.core.C4NativePeer.updateHistory(C4NativePeer.java:245)
                                                                                                    	at com.couchbase.lite.internal.core.C4NativePeer.<init>(C4NativePeer.java:59)
                                                                                                    	at com.couchbase.lite.internal.core.C4Query.<init>(C4Query.java:71)
                                                                                                    	at com.couchbase.lite.internal.core.C4Query.create(C4Query.java:51)
                                                                                                    	at com.couchbase.lite.internal.core.C4Database.createJsonQuery(C4Database.java:568)
                                                                                                    	at com.couchbase.lite.AbstractDatabase.createJsonQuery(AbstractDatabase.java:1264)
                                                                                                    	at com.couchbase.lite.BuilderQuery.prepQueryLocked(BuilderQuery.java:86)
                                                                                                    	at com.couchbase.lite.AbstractQuery.getC4QueryLocked(AbstractQuery.java:281)
                                                                                                    	at com.couchbase.lite.AbstractQuery.execute(AbstractQuery.java:169)
                                                                                                    	at com.couchbase.lite.Where.execute(Where.java:30)

3) I am seeing the following crash on a low spec device running Android 8.1, not sure if there is anything that can be done about it seems to clog up the weak global references table causing a JNI ERROR (app bug): weak global reference table overflow (max=51200) see attached file for full stack trace.

error_log.zip (12.4 KB)

Appreciate any help available and please let me know if I can give any more information.

Hey @meirrosendorff,

You appear to be using an internal only interface:

    @Internal("This interface is not part of the public API")
    public static void init(@NonNull Context ctxt, boolean debug) ...

Turning on debug logging is intended only for diagnostic use. Turning it on causes the generation lots and lots of logs. (#1). Among the logs that are generated are notifications of AutoCloseables that are finalized instead of being closed explicitly. That is entirely expected and part of the way the platform works. (#2)

You’ve included only the crash dump, for (#3), so I don’t have a lot to go on, there. It doesn’t look like the crash has anything at all to do with Couchbase Mobile but, rather, a Google library named “com.google.android.gms.dynamite…”. There is code in the 3.2.0 release that creates WeakGlobalReferences… but with only this stack trace to go on, I don’t think that code is involved.

Hi @blake.meike

As usual thank you for the timeous response, my apologies you are 100% correct, we mistakenly switched on the debug mode. In regard to the third point, I apologies again, I have done more digging and it seems related to having the debugger attached on that device.

Yes!!! I have seen that as well! I’m sorry I didn’t mention it! The debugger uses WeakLocalReferences. A thread stopped at a breakpoint can cause the JVM to run out.