couchbaselabs / cbforest

C++ wrapper library around ForestDB, for use in Couchbase Lite.
17 stars 12 forks source link

1.4.0 ForestDb crash in _fdb_compact_file #117

Open hideki opened 7 years ago

hideki commented 7 years ago

Original ticket: https://github.com/couchbase/couchbase-lite-java-core/issues/1640


1)Official CBL 1.4.0 is used. 2)Client was doing continuous push and pull from server 07/05 01:54:08.559 to 07/05 01:54:27.509. 3)~ 650 documents were pushed and and ~650 where pulled from server in ~20 secs. 4)dbcompact was not called by app. 5) As per CBL logs last operation was put as below.

[07/05 01:54:39.245] [114] Sync: PullerInternal{https://---:---@syncqc3.xyz.com/ptxdata, pull, 0adda}: start put remote _local document.  checkpointID: 0adda0411d586cc1a871700d1c2e6ec159bd43d4 body: {_rev=0-32, lastSequence=277879, _id=_local/0adda0411d586cc1a871700d1c2e6ec159bd43d4}
[07/05 01:54:39.249] [114] Sync: [sendAsyncRequest()] PUT => https://919999900010:b768c0db95fb135b80947fa9da238790@syncqc3.xyz.com/ptxdata/_local/0adda0411d586cc1a871700d1c2e6ec159bd43d4

5)ForestDB Crash seen , below is stack trace:

07-05 13:54:27.551 F/DEBUG   ( 3034): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
07-05 13:54:27.581 F/DEBUG   ( 3034):     r0 00000000  r1 000065dc  r2 00000006  r3 d47bf978
07-05 13:54:27.581 F/DEBUG   ( 3034):     r4 d47bf980  r5 d47bf930  r6 00000002  r7 0000010c
07-05 13:54:27.581 F/DEBUG   ( 3034):     r8 cfc3b260  r9 d127fe48  sl d46c1000  fp d48d9235
07-05 13:54:27.581 F/DEBUG   ( 3034):     ip 00000006  sp d47be078  lr f72e8365  pc f72ea754  cpsr 400f0010
07-05 13:54:27.591 F/DEBUG   ( 3034): 
07-05 13:54:27.591 F/DEBUG   ( 3034): backtrace:
07-05 13:54:27.591 F/DEBUG   ( 3034):     #00 pc 00042754  /system/lib/libc.so (tgkill+12)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #01 pc 00040361  /system/lib/libc.so (pthread_kill+32)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #02 pc 0001ca9b  /system/lib/libc.so (raise+10)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #03 pc 00019d19  /system/lib/libc.so (__libc_android_abort+34)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #04 pc 0001755c  /system/lib/libc.so (abort+4)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #05 pc 00159ba3  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (__gnu_cxx::__verbose_terminate_handler()+230)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #06 pc 0012a101  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (__cxxabiv1::__terminate(void (*)())+4)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #07 pc 0012a209  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (std::terminate()+8)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #08 pc 0012a39b  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (__cxa_throw+110)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #09 pc 000adc99  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (cbforest::error::_throw(fdb_status)+76)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #10 pc 000b55dd  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (cbforest::KeyStore::read(cbforest::Document&, cbforest::KeyStore::contentOptions) const+68)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #11 pc 000b557f  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (cbforest::KeyStore::get(cbforest::slice, cbforest::KeyStore::contentOptions) const+34)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #12 pc 000ab533  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (cbforest::Database::updatePurgeCount()+86)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #13 pc 000abebd  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (cbforest::Database::onCompact(unsigned int, char const*, fdb_doc_struct*, unsigned long long, unsigned long long)+56)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #14 pc 000aacf9  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (cbforest::Database::compactionCallback(_fdb_file_handle*, unsigned int, char const*, fdb_doc_struct*, unsigned long long, unsigned long long, void*)+8)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #15 pc 0008c45b  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (_fdb_compact_file(_fdb_kvs_handle*, filemgr*, btreeblk_handle*, docio_handle*, hbtrie*, hbtrie*, btree*, btree*, unsigned long long, bool)+6742)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #16 pc 0008a9bf  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (fdb_compact_file+698)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #17 pc 000766e3  /data/app/com.att.eptt-1/lib/arm/libCouchbaseLiteJavaForestDB.so (compactor_thread(void*)+1198)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #18 pc 0003fc63  /system/lib/libc.so (__pthread_start(void*)+30)
07-05 13:54:27.591 F/DEBUG   ( 3034):     #19 pc 0001a39b  /system/lib/libc.so (__start_thread+6)

Thanks Nithin

hideki commented 7 years ago

In callback from compact, cbforest calls fdb_get(_handle, doc), but it returns non-FDB_RESULT_SUCCESS, and cbforest throws exception. But the exception is not caught by caller method.