Commit ef3dcac
committed
Fix deadlock in SearchPhaseControllerTests cancellation tests
The cancellation tests could deadlock when threads are delayed by OS
scheduling. If cancellation triggers before all threads start, late
threads may hit a code path where batchReduceSize causes the latch
callback to be deferred to a MergeTask. Under certain timing conditions,
these callbacks never execute, causing latch.await() to hang indefinitely.
Ensure latch.countDown() is always called by wrapping consumeResult in
try-catch. This guarantees test completion regardless of cancellation
timing or exceptions.
Fixes opensearch-project#19094
Signed-off-by: Atri Sharma <atri.jiit@gmail.com>1 parent f2a664a commit ef3dcac
File tree
1 file changed
+7
-1
lines changed- server/src/test/java/org/opensearch/action/search
1 file changed
+7
-1
lines changedLines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1826 | 1826 | | |
1827 | 1827 | | |
1828 | 1828 | | |
1829 | | - | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
1830 | 1836 | | |
1831 | 1837 | | |
1832 | 1838 | | |
| |||
0 commit comments