Commit 7cdf40e
Fix deadlock in SearchPhaseControllerTests cancellation tests (opensearch-project#19171)
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.
Signed-off-by: Atri Sharma <atri.jiit@gmail.com>
Signed-off-by: Ankit Jain <jainankitk@apache.org>1 parent 60d2e66 commit 7cdf40e
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