Skip to content

Commit 2ebfc6c

Browse files
Add comment to explain why
1 parent f7a9725 commit 2ebfc6c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

server/src/main/java/org/elasticsearch/search/SearchService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,8 @@ private DefaultSearchContext createSearchContext(ShardSearchRequest request, Tim
643643
if (success == false) {
644644
IOUtils.closeWhileHandlingException(searchContext);
645645
if (searchContext == null) {
646+
// we handle the case where the DefaultSearchContext constructor throws an exception since we would otherwise
647+
// leak a searcher and this can have severe implications (unable to obtain shard lock exceptions).
646648
IOUtils.closeWhileHandlingException(searcher);
647649
}
648650
}

0 commit comments

Comments
 (0)