* If `counter.onResult` throws an exception we might leak a transport task because the failure is not handled as a phase failure (instead it bubbles up in the transport service eventually hitting the `onFailure` callback again and couting down the `counter` twice). Co-authored-by: Jim Ferenczi <jim.ferenczi@elastic.co>
This commit is contained in:
parent
2a70d38439
commit
5f6bc6fc2d
|
@ -80,7 +80,11 @@ final class DfsQueryPhase extends SearchPhase {
|
|||
|
||||
@Override
|
||||
protected void innerOnResponse(QuerySearchResult response) {
|
||||
counter.onResult(response);
|
||||
try {
|
||||
counter.onResult(response);
|
||||
} catch (Exception e) {
|
||||
context.onPhaseFailure(DfsQueryPhase.this, "", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -163,7 +163,11 @@ final class FetchSearchPhase extends SearchPhase {
|
|||
new SearchActionListener<FetchSearchResult>(shardTarget, shardIndex) {
|
||||
@Override
|
||||
public void innerOnResponse(FetchSearchResult result) {
|
||||
counter.onResult(result);
|
||||
try {
|
||||
counter.onResult(result);
|
||||
} catch (Exception e) {
|
||||
context.onPhaseFailure(FetchSearchPhase.this, "", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue