Details
Description
ThreadSanitizer is reporting a potential deadlock due to lock inversion in forestdb, via the ep-engine_kvstore-test testcase:
couchbase@00b591814417:~/couchbase/build/ep-engine$ TSAN_OPTIONS=second_deadlock_stack=1 ./ep-engine_kvstore_test
|
==================
|
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=2251)
|
Cycle in lock order graph: M253 (0x7d040000f770) => M282 (0x7d0c0000ef10) => M253
|
|
Mutex M282 acquired here while holding mutex M253 in main thread:
|
#0 pthread_mutex_lock <null> (ep-engine_kvstore_test+0x0000004830e0)
|
#1 mutex_lock_wrap(void*) /home/couchbase/.ccache/tmp/filemgr.tmp.00b591814417.24399.ii (libforestdb.so+0x000000020a55)
|
#2 plock_lock crtstuff.c (libforestdb.so+0x00000005466b)
|
#3 filemgr_write_offset crtstuff.c (libforestdb.so+0x000000022f8d)
|
#4 docio_append_doc_raw /home/couchbase/couchbase/forestdb/src/docio.cc:112 (libforestdb.so+0x00000001a91d)
|
#5 _docio_append_doc(docio_handle*, docio_object*) /home/couchbase/couchbase/forestdb/src/docio.cc:460 (libforestdb.so+0x00000001e200)
|
#6 docio_append_doc_system /home/couchbase/couchbase/forestdb/src/docio.cc:515 (libforestdb.so+0x00000001b1ab)
|
#7 fdb_kvs_header_append crtstuff.c (libforestdb.so+0x00000004f176)
|
#8 _fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:1699 (libforestdb.so+0x000000028364)
|
#9 fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:623 (libforestdb.so+0x000000026b06)
|
#10 ForestKVStore::ForestKVStore(KVStoreConfig&) /home/couchbase/couchbase/ep-engine/src/forest-kvstore/forest-kvstore.cc:105 (ep-engine_kvstore_test+0x0000004f2aaa)
|
#11 KVStoreFactory::create(KVStoreConfig&, bool) /home/couchbase/couchbase/ep-engine/src/kvstore.cc:54 (ep-engine_kvstore_test+0x0000004cb760)
|
#12 basic_kvstore_test(std::string&) /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:114 (ep-engine_kvstore_test+0x0000004c66ea)
|
#13 main /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:183 (ep-engine_kvstore_test+0x0000004c8584)
|
|
Mutex M253 previously acquired by the same thread here:
|
#0 pthread_spin_lock <null> (ep-engine_kvstore_test+0x000000466110)
|
#1 spin_lock_wrap(void*) /home/couchbase/.ccache/tmp/filemgr.tmp.00b591814417.24399.ii (libforestdb.so+0x000000020ae5)
|
#2 plock_lock crtstuff.c (libforestdb.so+0x0000000543ee)
|
#3 filemgr_write_offset crtstuff.c (libforestdb.so+0x000000022f8d)
|
#4 docio_append_doc_raw /home/couchbase/couchbase/forestdb/src/docio.cc:112 (libforestdb.so+0x00000001a91d)
|
#5 _docio_append_doc(docio_handle*, docio_object*) /home/couchbase/couchbase/forestdb/src/docio.cc:460 (libforestdb.so+0x00000001e200)
|
#6 docio_append_doc_system /home/couchbase/couchbase/forestdb/src/docio.cc:515 (libforestdb.so+0x00000001b1ab)
|
#7 fdb_kvs_header_append crtstuff.c (libforestdb.so+0x00000004f176)
|
#8 _fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:1699 (libforestdb.so+0x000000028364)
|
#9 fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:623 (libforestdb.so+0x000000026b06)
|
#10 ForestKVStore::ForestKVStore(KVStoreConfig&) /home/couchbase/couchbase/ep-engine/src/forest-kvstore/forest-kvstore.cc:105 (ep-engine_kvstore_test+0x0000004f2aaa)
|
#11 KVStoreFactory::create(KVStoreConfig&, bool) /home/couchbase/couchbase/ep-engine/src/kvstore.cc:54 (ep-engine_kvstore_test+0x0000004cb760)
|
#12 basic_kvstore_test(std::string&) /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:114 (ep-engine_kvstore_test+0x0000004c66ea)
|
#13 main /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:183 (ep-engine_kvstore_test+0x0000004c8584)
|
|
Mutex M253 acquired here while holding mutex M282 in main thread:
|
#0 pthread_spin_lock <null> (ep-engine_kvstore_test+0x000000466110)
|
#1 spin_lock_wrap(void*) /home/couchbase/.ccache/tmp/filemgr.tmp.00b591814417.24399.ii (libforestdb.so+0x000000020ae5)
|
#2 plock_unlock crtstuff.c (libforestdb.so+0x0000000547fd)
|
#3 filemgr_write_offset crtstuff.c (libforestdb.so+0x000000023450)
|
#4 docio_append_doc_raw /home/couchbase/couchbase/forestdb/src/docio.cc:112 (libforestdb.so+0x00000001a91d)
|
#5 _docio_append_doc(docio_handle*, docio_object*) /home/couchbase/couchbase/forestdb/src/docio.cc:460 (libforestdb.so+0x00000001e200)
|
#6 docio_append_doc_system /home/couchbase/couchbase/forestdb/src/docio.cc:515 (libforestdb.so+0x00000001b1ab)
|
#7 fdb_kvs_header_append crtstuff.c (libforestdb.so+0x00000004f176)
|
#8 _fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:1699 (libforestdb.so+0x000000028364)
|
#9 fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:623 (libforestdb.so+0x000000026b06)
|
#10 ForestKVStore::ForestKVStore(KVStoreConfig&) /home/couchbase/couchbase/ep-engine/src/forest-kvstore/forest-kvstore.cc:105 (ep-engine_kvstore_test+0x0000004f2aaa)
|
#11 KVStoreFactory::create(KVStoreConfig&, bool) /home/couchbase/couchbase/ep-engine/src/kvstore.cc:54 (ep-engine_kvstore_test+0x0000004cb760)
|
#12 basic_kvstore_test(std::string&) /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:114 (ep-engine_kvstore_test+0x0000004c66ea)
|
#13 main /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:183 (ep-engine_kvstore_test+0x0000004c8584)
|
|
Mutex M282 previously acquired by the same thread here:
|
#0 pthread_mutex_lock <null> (ep-engine_kvstore_test+0x0000004830e0)
|
#1 mutex_lock_wrap(void*) /home/couchbase/.ccache/tmp/filemgr.tmp.00b591814417.24399.ii (libforestdb.so+0x000000020a55)
|
#2 plock_lock crtstuff.c (libforestdb.so+0x00000005466b)
|
#3 filemgr_write_offset crtstuff.c (libforestdb.so+0x000000022f8d)
|
#4 docio_append_doc_raw /home/couchbase/couchbase/forestdb/src/docio.cc:112 (libforestdb.so+0x00000001a91d)
|
#5 _docio_append_doc(docio_handle*, docio_object*) /home/couchbase/couchbase/forestdb/src/docio.cc:460 (libforestdb.so+0x00000001e200)
|
#6 docio_append_doc_system /home/couchbase/couchbase/forestdb/src/docio.cc:515 (libforestdb.so+0x00000001b1ab)
|
#7 fdb_kvs_header_append crtstuff.c (libforestdb.so+0x00000004f176)
|
#8 _fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:1699 (libforestdb.so+0x000000028364)
|
#9 fdb_open /home/couchbase/couchbase/forestdb/src/forestdb.cc:623 (libforestdb.so+0x000000026b06)
|
#10 ForestKVStore::ForestKVStore(KVStoreConfig&) /home/couchbase/couchbase/ep-engine/src/forest-kvstore/forest-kvstore.cc:105 (ep-engine_kvstore_test+0x0000004f2aaa)
|
#11 KVStoreFactory::create(KVStoreConfig&, bool) /home/couchbase/couchbase/ep-engine/src/kvstore.cc:54 (ep-engine_kvstore_test+0x0000004cb760)
|
#12 basic_kvstore_test(std::string&) /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:114 (ep-engine_kvstore_test+0x0000004c66ea)
|
#13 main /home/couchbase/couchbase/ep-engine/tests/module_tests/kvstore_test.cc:183 (ep-engine_kvstore_test+0x0000004c8584)
|
|
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) ??:0 pthread_mutex_lock
|
This is reminiscent of MB-15502, another reported lock-order inversion, which was closed as "Won't Fix" as we believed that ThreadSanitizer was mistaken.
Could you take another look at this? If we really believe this is another incorrect report we should add a suppression to tlm/tsan.suppressions.
Attachments
Issue Links
- relates to
-
MB-15502 lock-order-inversion (potential deadlock) in forestdb partiallock
- Closed