Commit 2c27ad5
authored
Make testRetriesCantBeExecutedForTooManyRequestMessages more reliable (#1781)
Motivation:
The 'testRetriesCantBeExecutedForTooManyRequestMessages' test wedges
infrequently. After some diagnosis this appears to be due to the
intersection of two bugs. The first is that when yielding an element to
the sequence, if some consumers exist, of which a subset are waiting for
the next element and the remainder are not 'slow', the continuations of
the fastest consumers would not be resumed when a new element was added.
The other bug is a timing issue: when waiting for the next element a
subscriber may be told to suspend. However, the subscriber must drop and
then reacquire the lock to store the continuation. The state wasn't
re-checked on storing the continuation which opened up a window where
the element may have become present between asking for it and storing
the continuation.
Modifications:
- Don't release the lock between attempting to consume an element and
suspending to wait for it.
- Resume waiting consumers more frequently.
- Make a few tests less flaky
Result:
Test didn't wedge in 10k iterations1 parent 2034543 commit 2c27ad5
File tree
2 files changed
+69
-20
lines changed- Sources/GRPCCore
- Internal/Concurrency Primitives
- Streaming/Internal
2 files changed
+69
-20
lines changedLines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
256 | 290 | | |
257 | 291 | | |
258 | 292 | | |
Lines changed: 35 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
265 | 269 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
270 | 275 | | |
271 | | - | |
272 | | - | |
| 276 | + | |
273 | 277 | | |
274 | | - | |
| 278 | + | |
275 | 279 | | |
276 | 280 | | |
277 | 281 | | |
| 282 | + | |
| 283 | + | |
278 | 284 | | |
279 | 285 | | |
280 | 286 | | |
281 | 287 | | |
282 | 288 | | |
283 | 289 | | |
284 | 290 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
289 | 296 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
296 | 302 | | |
297 | 303 | | |
298 | 304 | | |
| |||
572 | 578 | | |
573 | 579 | | |
574 | 580 | | |
575 | | - | |
| 581 | + | |
| 582 | + | |
576 | 583 | | |
577 | | - | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
578 | 593 | | |
579 | 594 | | |
580 | 595 | | |
| |||
0 commit comments