Skip to content

Commit 2f9e7bb

Browse files
authored
Merge pull request #4836 from gchq/gh-4829
#4829 Fix stuck searches
2 parents f7da6e4 + 8f25c06 commit 2f9e7bb

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

Diff for: stroom-search/stroom-search-impl/src/main/java/stroom/search/impl/RemoteSearchService.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,24 @@ public Boolean start(final NodeSearchTask nodeSearchTask) {
108108
// Tell the coprocessors they can complete now as we won't be receiving
109109
// payloads.
110110
LOGGER.trace(() -> "Search is complete, setting searchComplete to true and " +
111-
"counting down searchCompleteLatch");
111+
"counting down searchCompleteLatch");
112112
coprocessors.getCompletionState().signalComplete();
113113

114114
// Wait for the coprocessors to actually complete, i.e. consume last items from
115-
// the queue and send laST payloads etc.
116-
while (!coprocessors.getCompletionState().awaitCompletion(1,
117-
TimeUnit.SECONDS)) {
115+
// the queue and send last payloads etc.
116+
while (!taskContext.isTerminated() &&
117+
!coprocessors.getCompletionState().awaitCompletion(1,
118+
TimeUnit.SECONDS)) {
118119
nodeSearchTaskHandler.updateInfo();
119120
}
121+
120122
} catch (final InterruptedException e) {
121123
LOGGER.trace(e::getMessage, e);
122124
// Keep interrupting this thread.
123125
Thread.currentThread().interrupt();
126+
127+
} finally {
128+
coprocessors.clear();
124129
}
125130
}
126131
});

Diff for: unreleased_changes/20250326_123117_493__4829.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
* Issue **#4829** : Fix stuck searches.
2+
3+
4+
```sh
5+
# ********************************************************************************
6+
# Issue title: Search preventing shutdown / long running task: 7.8 and 7.9
7+
# Issue link: https://github.com/gchq/stroom/issues/4829
8+
# ********************************************************************************
9+
10+
# ONLY the top line will be included as a change entry in the CHANGELOG.
11+
# The entry should be in GitHub flavour markdown and should be written on a SINGLE
12+
# line with no hard breaks. You can have multiple change files for a single GitHub issue.
13+
# The entry should be written in the imperative mood, i.e. 'Fix nasty bug' rather than
14+
# 'Fixed nasty bug'.
15+
#
16+
# Examples of acceptable entries are:
17+
#
18+
#
19+
# * Issue **123** : Fix bug with an associated GitHub issue in this repository
20+
#
21+
# * Issue **namespace/other-repo#456** : Fix bug with an associated GitHub issue in another repository
22+
#
23+
# * Fix bug with no associated GitHub issue.
24+
```

0 commit comments

Comments
 (0)