Commit 17079bd
committed
fix(threading): Dispose also refuses a ReaderWriterLockSlim with waiters (#2389)
Completes what #1956 half-landed. .NET's Dispose performs TWO checks
(ReaderWriterLockSlim.cs:1250-1258) and #1956's design record named only the
held-mode one, so Dispose accepted a lock other threads were waiting for.
waitingReaders_ and waitingUpgraders_ join SR-AUD-204's waitingWriters_, and
both checks now run in .NET's order.
The two new counters feed no admission predicate -- only writer-waiting does
-- so their guards take notifyOnLast=false and cannot perturb wake-up
ordering.
sizeof 120 -> 128: SR-AUD-204's single counter fit existing padding and these
two did not, so consumers must rebuild. The pre-existing layout gate was
updated from 120 to 128.
Four mutations, all caught -- but only after two defects were found, and
those are the substance of this ticket:
1. The first run reported all four "caught" by a test that was ALREADY
FAILING: the layout gate asserts 120 and was failing on the unmutated
build too, so no verdict meant anything. A mutation verdict is only
evidence against a baseline that passes.
2. Re-run green, M1 and M2 came back NOT CAUGHT -- a real defect in my
tests, which disposed from a thread that also held a mode, so the
held-mode check fired and the waiter check was never exercised. The
disposer must hold nothing.
3. The corrected tests then flaked inside the gate: a fixed 150 ms settle
does not guarantee the waiter has been counted. Tuning the sleep would
have been the wrong repair. They now rebuild the scenario over up to six
attempts and pass the moment Dispose refuses -- sound rather than
tolerant, since only a genuinely firing check can pass, and every
mutation still fails all six.
That layout gate doing its job is also the evidence 128 is a real change
rather than drift: it stayed green through SR-AUD-204's earlier counter.
Downstream measured: 0 sites in cna, 0 in mobile-eggbert.
Gate: 17,482 run, 17,482 passed, 0 failed, 0 skipped across 38 executables
(+6 on 17,476; SharpRuntimeTests_Threading 500 -> 506; no other executable
moved). Module graph unchanged at 41/93.1 parent 9f3114c commit 17079bd
6 files changed
Lines changed: 334 additions & 22 deletions
File tree
- docs
- modules/threading
- include/System/Threading
- tests/System/Threading
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
Lines changed: 43 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
109 | 128 | | |
110 | 129 | | |
111 | 130 | | |
| |||
236 | 255 | | |
237 | 256 | | |
238 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
239 | 261 | | |
240 | 262 | | |
241 | 263 | | |
| |||
304 | 326 | | |
305 | 327 | | |
306 | 328 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 329 | + | |
314 | 330 | | |
315 | 331 | | |
316 | 332 | | |
| |||
384 | 400 | | |
385 | 401 | | |
386 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
387 | 406 | | |
388 | 407 | | |
389 | 408 | | |
| |||
409 | 428 | | |
410 | 429 | | |
411 | 430 | | |
412 | | - | |
413 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
414 | 435 | | |
415 | 436 | | |
416 | 437 | | |
417 | 438 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
423 | 444 | | |
424 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
425 | 454 | | |
426 | 455 | | |
427 | 456 | | |
| |||
0 commit comments