Commit 8143c1e
authored
General: Stop the shared resource churn tests flaking on a benign teardown race (#59)
The churn retry loops in SharedResourceTest read r.item on a resource
freshly returned by get(). When gen-1 dies spontaneously, its async
onCompletion cleanup force-closes every lease, including one that get()
just handed out: the isClosed re-check inside get() and the caller's
item read are not atomic. Resource.item then throws
CancellationException("Resource was cancelled!"), failing the test.
Observed in CI on the testGplay lane (run 32723097381, attempt 1) at
SharedResourceTest.kt:918 with item value 1, i.e. a dead gen-1 reuse.
Force-closing the leases of a spontaneously dead generation is designed
behavior, so this is test tolerance, not a product fix: both churn loops
now catch the throwing read and treat it as another dead-gen-1 reuse to
retry. The supersede test's loop had the identical latent race.1 parent 7348084 commit 8143c1e
1 file changed
Lines changed: 6 additions & 2 deletions
File tree
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | | - | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
839 | 841 | | |
840 | 842 | | |
841 | 843 | | |
| |||
915 | 917 | | |
916 | 918 | | |
917 | 919 | | |
918 | | - | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
919 | 923 | | |
920 | 924 | | |
921 | 925 | | |
| |||
0 commit comments