Hello, Can someone help me to understand why there is a potential data race here?
Access to the data structure is protected by a mutex, and the error message seems to even report that. So why is this a potential race? ==9352== ---------------------------------------------------------------- ==9352== ==9352== Lock at 0x634AF38 was first observed ==9352== at 0x4C3010C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x11A142: __gthread_mutex_lock (gthr-default.h:748) ==9352== by 0x11A142: std::mutex::lock() (std_mutex.h:103) ==9352== by 0x116E14: lock_guard (std_mutex.h:162) ==9352== by 0x116E14: sfs_do_readdir(fuse_req*, unsigned long, unsigned long, long, fuse_file_info*, int) (steamfs.cpp:916) ==9352== by 0x4E51259: do_readdirplus (fuse_lowlevel.c:1469) ==9352== by 0x4E53C20: fuse_session_process_buf_int (fuse_lowlevel.c:2555) ==9352== by 0x4E4F980: fuse_do_work (fuse_loop_mt.c:160) ==9352== by 0x4C32D06: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x507E493: start_thread (pthread_create.c:333) ==9352== by 0x5915ACE: clone (clone.S:97) ==9352== Address 0x634af38 is 24 bytes inside a block of size 64 alloc'd ==9352== at 0x4C2D8CF: operator new(unsigned long, std::nothrow_t const&) (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x1146D0: sfs_opendir(fuse_req*, unsigned long, fuse_file_info*) (steamfs.cpp:864) ==9352== by 0x4E52D0B: do_opendir (fuse_lowlevel.c:1441) ==9352== by 0x4E53C20: fuse_session_process_buf_int (fuse_lowlevel.c:2555) ==9352== by 0x4E4F980: fuse_do_work (fuse_loop_mt.c:160) ==9352== by 0x4C32D06: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x507E493: start_thread (pthread_create.c:333) ==9352== by 0x5915ACE: clone (clone.S:97) ==9352== Block was alloc'd by thread #3 ==9352== ==9352== Possible data race during read of size 8 at 0x634AF30 by thread #5 ==9352== Locks held: 1, at address 0x634AF38 ==9352== at 0x116E15: sfs_do_readdir(fuse_req*, unsigned long, unsigned long, long, fuse_file_info*, int) (steamfs.cpp:917) ==9352== by 0x4E51259: do_readdirplus (fuse_lowlevel.c:1469) ==9352== by 0x4E53C20: fuse_session_process_buf_int (fuse_lowlevel.c:2555) ==9352== by 0x4E4F980: fuse_do_work (fuse_loop_mt.c:160) ==9352== by 0x4C32D06: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x507E493: start_thread (pthread_create.c:333) ==9352== by 0x5915ACE: clone (clone.S:97) ==9352== ==9352== This conflicts with a previous write of size 8 by thread #3 ==9352== Locks held: 1, at address 0x634AF38 ==9352== at 0x116E81: sfs_do_readdir(fuse_req*, unsigned long, unsigned long, long, fuse_file_info*, int) (steamfs.cpp:938) ==9352== by 0x4E51259: do_readdirplus (fuse_lowlevel.c:1469) ==9352== by 0x4E53C20: fuse_session_process_buf_int (fuse_lowlevel.c:2555) ==9352== by 0x4E4F980: fuse_do_work (fuse_loop_mt.c:160) ==9352== by 0x4C32D06: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x507E493: start_thread (pthread_create.c:333) ==9352== by 0x5915ACE: clone (clone.S:97) ==9352== Address 0x634af30 is 16 bytes inside a block of size 64 alloc'd ==9352== at 0x4C2D8CF: operator new(unsigned long, std::nothrow_t const&) (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x1146D0: sfs_opendir(fuse_req*, unsigned long, fuse_file_info*) (steamfs.cpp:864) ==9352== by 0x4E52D0B: do_opendir (fuse_lowlevel.c:1441) ==9352== by 0x4E53C20: fuse_session_process_buf_int (fuse_lowlevel.c:2555) ==9352== by 0x4E4F980: fuse_do_work (fuse_loop_mt.c:160) ==9352== by 0x4C32D06: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==9352== by 0x507E493: start_thread (pthread_create.c:333) ==9352== by 0x5915ACE: clone (clone.S:97) ==9352== Block was alloc'd by thread #3 ==9352== ==9352== ---------------------------------------------------------------- Best, -Nikolaus -- GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users