Commit 6a8c26d
authored
Fix race condition in async task reschedule test (elastic#137405) (elastic#137449)
When rescheduling a task, the task may begin running before the test is
able to take more actions. This means reseting the barriers in the auto
reschedule test may occur after the second run of the task has begun,
which results in a broken barrier.
This commit fixes the race condition by moving the reset of each barrier
to occur after the await for the relevant barrier. This ensures that
each barrier is ready to be awaited on again by the end of the run. Due
to there being two barriers, the second barrier may be reset after the
test codes second barrier1.await, but that is ok.
closes elastic#1311501 parent 4422bad commit 6a8c26d
File tree
1 file changed
+6
-2
lines changed- server/src/test/java/org/elasticsearch/common/util/concurrent
1 file changed
+6
-2
lines changedLines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| 74 | + | |
| 75 | + | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | | - | |
87 | | - | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
0 commit comments