Skip to content

Commit 8b1f8c1

Browse files
committed
DecRef for newly created hit on circuit breaking exception
1 parent 55f40ef commit 8b1f8c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.apache.lucene.index.LeafReaderContext;
1515
import org.apache.lucene.search.TotalHits;
1616
import org.elasticsearch.common.breaker.CircuitBreaker;
17+
import org.elasticsearch.common.breaker.CircuitBreakingException;
1718
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
1819
import org.elasticsearch.common.bytes.BytesReference;
1920
import org.elasticsearch.index.fieldvisitor.LeafStoredFieldLoader;
@@ -314,6 +315,9 @@ private static HitContext prepareNonNestedHitContext(
314315
BytesReference sourceRef = source.internalSourceRef();
315316
circuitBreaker.addEstimateBytesAndMaybeBreak(sourceRef.length(), "fetch phase source loader");
316317
hit.unfilteredSourceRef(sourceRef);
318+
} catch (CircuitBreakingException e) {
319+
hit.decRef();
320+
throw e;
317321
} finally {
318322
if (timer != null) {
319323
timer.stop();

0 commit comments

Comments
 (0)