- Notifications
You must be signed in to change notification settings - Fork1k
Commit4fc0093
authored
fix: fix TestCloserStack_Timeout to wait for all asyncClosers (#19837)
fixescoder/internal#966TestCloserStack_Timeout creates `asyncCloser`s which allow control over the exact timing and order of their close method returning. They also, as a final backstop will throw an error if the test context ends before they are unblocked.TestCloserStack_Timeout unblocks all `asyncCloser`s in a defer and then ends the test. This defer _unblocks_ the running close goroutines, but does not wait for them to finish. Since the test context is canceled as soon as the test completes, this creates a race condition where the close goroutines can trigger the context cancelled arm of the `select` statement.The fix is to both unblock and wait for all close goroutines to complete before ending the test and cancelling the context.1 parente6b04d1 commit4fc0093
1 file changed
+21
-16
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
158 | 158 |
| |
159 | 159 |
| |
160 | 160 |
| |
161 |
| - | |
| 161 | + | |
162 | 162 |
| |
163 | 163 |
| |
164 | 164 |
| |
| |||
178 | 178 |
| |
179 | 179 |
| |
180 | 180 |
| |
181 |
| - | |
| 181 | + | |
182 | 182 |
| |
| 183 | + | |
183 | 184 |
| |
184 | 185 |
| |
185 | 186 |
| |
| |||
198 | 199 |
| |
199 | 200 |
| |
200 | 201 |
| |
201 |
| - | |
| 202 | + | |
| 203 | + | |
202 | 204 |
| |
203 | 205 |
| |
204 | 206 |
| |
| |||
215 | 217 |
| |
216 | 218 |
| |
217 | 219 |
| |
218 |
| - | |
| 220 | + | |
219 | 221 |
| |
220 | 222 |
| |
221 | 223 |
| |
| |||
317 | 319 |
| |
318 | 320 |
| |
319 | 321 |
| |
320 |
| - | |
321 |
| - | |
322 |
| - | |
323 |
| - | |
324 |
| - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
325 | 328 |
| |
326 | 329 |
| |
327 | 330 |
| |
328 | 331 |
| |
| 332 | + | |
329 | 333 |
| |
330 | 334 |
| |
331 | 335 |
| |
332 | 336 |
| |
333 |
| - | |
| 337 | + | |
334 | 338 |
| |
335 | 339 |
| |
336 | 340 |
| |
337 | 341 |
| |
338 |
| - | |
339 |
| - | |
| 342 | + | |
| 343 | + | |
340 | 344 |
| |
341 | 345 |
| |
342 | 346 |
| |
343 | 347 |
| |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
348 | 353 |
| |
349 | 354 |
| |
350 | 355 |
| |
|
0 commit comments
Comments
(0)