-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Logging
-
Storage Engines
-
8
-
StorEng - 2024-09-03
While implementing WT-12610 this error was encountered:
WARNING: ThreadSanitizer: data race (pid=3277524) Atomic write of size 8 at 0xfffff3908048 by main thread (mutexes: write M1186, write M869, write M937): #0 __tsan_atomic64_store /data/mci/a0fb36c8538079c1f46d9ce374d7b561/toolchain-builder/tmp/build-llvm-v4.sh-XmU/llvm-project-llvmorg/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp:566:3 (ex_log+0x4989d4) #1 __wt_atomic_store64 /home/ubuntu/wiredtiger/src/include/gcc.h:175:1 (libwiredtiger.so.11.3.0+0x1f2e30) #2 __log_slot_close /home/ubuntu/wiredtiger/src/log/log_slot.c:184:5 (libwiredtiger.so.11.3.0+0x1f4dc4) #3 __log_slot_switch_internal /home/ubuntu/wiredtiger/src/log/log_slot.c:347:15 (libwiredtiger.so.11.3.0+0x1f3518) #4 __wt_log_slot_switch /home/ubuntu/wiredtiger/src/log/log_slot.c:408:9 (libwiredtiger.so.11.3.0+0x1f3020) #5 __log_write_internal /home/ubuntu/wiredtiger/src/log/log.c:2700:15 (libwiredtiger.so.11.3.0+0x1ea204) #6 __wt_log_write /home/ubuntu/wiredtiger/src/log/log.c:2595:11 (libwiredtiger.so.11.3.0+0x1e9a6c) #7 __txn_log_file_sync /home/ubuntu/wiredtiger/src/txn/txn_log.c:352:5 (libwiredtiger.so.11.3.0+0x2f1994) #8 __wt_txn_checkpoint_log /home/ubuntu/wiredtiger/src/txn/txn_log.c:461:17 (libwiredtiger.so.11.3.0+0x2f12c8) #9 __wt_meta_track_off /home/ubuntu/wiredtiger/src/meta/meta_track.c:285:9 (libwiredtiger.so.11.3.0+0x220044) #10 __schema_create /home/ubuntu/wiredtiger/src/schema/schema_create.c:1453:5 (libwiredtiger.so.11.3.0+0x270f74) #11 __wt_schema_create /home/ubuntu/wiredtiger/src/schema/schema_create.c:1489:11 (libwiredtiger.so.11.3.0+0x270a50) #12 __wt_session_create /home/ubuntu/wiredtiger/src/session/session_api.c:968:5 (libwiredtiger.so.11.3.0+0x28541c) #13 __session_create /home/ubuntu/wiredtiger/src/session/session_api.c:1014:11 (libwiredtiger.so.11.3.0+0x289a88) #14 setup_copy /home/ubuntu/wiredtiger/examples/c/ex_log.c:47:5 (ex_log+0x4beca0) #15 walk_log /home/ubuntu/wiredtiger/examples/c/ex_log.c:148:5 (ex_log+0x4be260) #16 main /home/ubuntu/wiredtiger/examples/c/ex_log.c:305:5 (ex_log+0x4bdd90) Previous read of size 8 at 0xfffff3908048 by thread T33: #0 __log_wrlsn_server /home/ubuntu/wiredtiger/src/conn/conn_log.c:838:21 (libwiredtiger.so.11.3.0+0x14060c) Location is heap block of size 15960 at 0xfffff3908000 allocated by main thread: #0 calloc /data/mci/a0fb36c8538079c1f46d9ce374d7b561/toolchain-builder/tmp/build-llvm-v4.sh-XmU/llvm-project-llvmorg/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:668:5 (ex_log+0x4457b4) #1 __wt_calloc /home/ubuntu/wiredtiger/src/os_common/os_alloc.c:35:14 (libwiredtiger.so.11.3.0+0x228be8) #2 __wt_logmgr_create /home/ubuntu/wiredtiger/src/conn/conn_log.c:982:5 (libwiredtiger.so.11.3.0+0x13f984) #3 __wt_connection_workers /home/ubuntu/wiredtiger/src/conn/conn_open.c:225:5 (libwiredtiger.so.11.3.0+0x143378) #4 wiredtiger_open /home/ubuntu/wiredtiger/src/conn/conn_api.c:3242:5 (libwiredtiger.so.11.3.0+0x1205c0) #5 setup_copy /home/ubuntu/wiredtiger/examples/c/ex_log.c:44:5 (ex_log+0x4bec2c) #6 walk_log /home/ubuntu/wiredtiger/examples/c/ex_log.c:148:5 (ex_log+0x4be260) #7 main /home/ubuntu/wiredtiger/examples/c/ex_log.c:305:5 (ex_log+0x4bdd90)
The reading line in question:
prev = log->alloc_lsn;
Copies a WT_LSN struct from alloc_lsn to prev. This cannot be done using the standard atomic primitives. The associated write that was detected is in log_slot.c:
WT_ASSIGN_LSN(&log->alloc_lsn, &slot->slot_end_lsn);
We will need to find a clean way to copy the struct atomically. In order to move the TSAN work forward we have suppressed the __log_wrlsn_server function or the time being.