Commit 17707be
authored
fix: Fix race in emulator controller (#2836)
Fix TSan data race in EmulatorController by synchronizing logging threads.
The race condition occurred when a previous emulator process instance was shutting down
while a new instance was starting. The logging threads for stdout/stderr of the previous
process could still be reading from file descriptors that were subsequently reused for
the new process's pipes.
This fix ensures that:
1. Logging threads are tracked.
2. EmulatorController.stop() joins these threads after destroying the process.
3. EmulatorController.stop() waits for the process to exit completely.1 parent b7a0232 commit 17707be
1 file changed
Lines changed: 23 additions & 3 deletions
File tree
- google-cloud-bigtable-emulator-core/src/main/java/com/google/cloud/bigtable/emulator/core
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
130 | | - | |
131 | | - | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
167 | 186 | | |
168 | 187 | | |
169 | 188 | | |
| |||
239 | 258 | | |
240 | 259 | | |
241 | 260 | | |
242 | | - | |
| 261 | + | |
243 | 262 | | |
244 | 263 | | |
245 | 264 | | |
| |||
258 | 277 | | |
259 | 278 | | |
260 | 279 | | |
| 280 | + | |
261 | 281 | | |
262 | 282 | | |
263 | 283 | | |
0 commit comments