What
ThreadSanitizer detected a data race in config_watcher.h between:
cleanup_inotify() (main thread) writing to inotify_fd_ at line 451-452
watch_loop_linux() (watcher thread) reading inotify_fd_ at lines 464, 474
The inotify_fd_ member is a plain int accessed from multiple threads without synchronization.
Why
This is a real data race that can cause:
- Reading a closed file descriptor
- Use-after-close on the inotify fd
- Undefined behavior under concurrent access
Currently suppressed via sanitizers/tsan_suppressions.txt (added in #396).
Where
include/kcenon/common/config/config_watcher.h lines 445-454 and 456-478
How
Option A: Use atomic for fd
Make inotify_fd_ and watch_fd_ atomic integers.
Option B: Signal-based shutdown
Use a pipe/eventfd to signal the watcher thread to stop.
Acceptance Criteria
What
ThreadSanitizer detected a data race in
config_watcher.hbetween:cleanup_inotify()(main thread) writing toinotify_fd_at line 451-452watch_loop_linux()(watcher thread) readinginotify_fd_at lines 464, 474The
inotify_fd_member is a plainintaccessed from multiple threads without synchronization.Why
This is a real data race that can cause:
Currently suppressed via
sanitizers/tsan_suppressions.txt(added in #396).Where
include/kcenon/common/config/config_watcher.hlines 445-454 and 456-478How
Option A: Use atomic for fd
Make
inotify_fd_andwatch_fd_atomic integers.Option B: Signal-based shutdown
Use a pipe/eventfd to signal the watcher thread to stop.
Acceptance Criteria
config_watcherremoved