Commit ad7d74e
Fix race condition in FileLogger2 constructor
The FileLogger2 constructor would start the writer thread after
registering status change callbacks in the base class. This created
a race condition where callbacks could fire before the writer thread
was ready, causing TSAN failures (double lock and data race errors).
Fix by adding an atomic 'ready' flag that is:
- Set to true when the writer thread starts running
- Checked in callback() before accessing the queue
Callbacks that arrive before the writer thread is ready are now
safely ignored.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 2e54ffb commit ad7d74e
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
105 | 115 | | |
106 | 116 | | |
107 | 117 | | |
| |||
0 commit comments