Fix several potential circuit breaker leaks in Aggregators#79676
Fix several potential circuit breaker leaks in Aggregators#79676iverase merged 10 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
# Conflicts: # test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
|
@elasticmachine run elasticsearch-ci/packaging-tests-unix-sample |
# Conflicts: # test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
nik9000
left a comment
There was a problem hiding this comment.
I wish there was a cleaner looking way to do this. But it does seem right. I left a question about one case that looked different from the others.
| /** Release the provided {@link Releasable}s. */ | ||
| public static void close(Releasable... releasables) { | ||
| close(Arrays.asList(releasables)); | ||
| if (releasables != null) { |
There was a problem hiding this comment.
It's kind of rude to pass a null list here.
There was a problem hiding this comment.
I moved the null check to the composite aggregator that was causing this issue.
| if (success == false) { | ||
| Releasables.close(metricValues); | ||
| } | ||
| } |
There was a problem hiding this comment.
I wonder if it's more clear to do this with one try block.
| boolean success = false; | ||
| try { | ||
| long[] mergeMap = new long[Math.toIntExact(oldOrds.size())]; | ||
| bucketOrds = new LongKeyedBucketOrds.FromMany(bigArrays()); |
There was a problem hiding this comment.
I think the problem here is that we may close oldOrds twice, right?
There was a problem hiding this comment.
Yes indeed that's the problem. We should not close oldOrds until we successfully allocated bucketOrds andwe need to close it at the end.
# Conflicts: # server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/OrdinalValuesSource.java
|
Hey @nik9000, Do you think we still want to pursue this change? |
I thought I replied to this last week..... I liked it. let me double check. |
|
@elasticmachine run elasticsearch-ci/part-2 |
…9676) This commit adds a new CircuitBreaker implementation in the test that throws CircuitBreaker Exceptions randomly. This new circuit breaker helps uncover several places where we might leak if the circuit breaker throws such exception.
…9676) This commit adds a new CircuitBreaker implementation in the test that throws CircuitBreaker Exceptions randomly. This new circuit breaker helps uncover several places where we might leak if the circuit breaker throws such exception.
…80928) This commit adds a new CircuitBreaker implementation in the test that throws CircuitBreaker Exceptions randomly. This new circuit breaker helps uncover several places where we might leak if the circuit breaker throws such exception.
…80929) This commit adds a new CircuitBreaker implementation in the test that throws CircuitBreaker Exceptions randomly. This new circuit breaker helps uncover several places where we might leak if the circuit breaker throws such exception.
|
I do hope that no more leaks can escape our testing :) |
* upstream/master: Cleanup SLM History Item .equals (elastic#80938) Rework breaking changes for new structure (elastic#80907) [DOCS] Fix elasticsearch-reset-password typo (elastic#80919) [ML] No need to use parent task client when internal infer delegates (elastic#80905) Fix shadowed vars pt6 (elastic#80899) add ignore info (elastic#80924) Fix several potential circuit breaker leaks in Aggregators (elastic#79676) # Conflicts: # server/src/internalClusterTest/java/org/elasticsearch/index/TimeSeriesModeIT.java
* upstream/master: (29 commits) Fix typo (elastic#80925) Increase docker compose timeouts for CI builds TSDB: fix error without feature flag (elastic#80945) [DOCS] Relocate `index.mapping.dimension_fields.limit` setting docs (elastic#80964) Explicit write methods for always-missing values (elastic#80958) TSDB: move TimeSeriesModeIT to yaml tests (elastic#80933) [ML] Removing temporary debug (elastic#80956) Remove unused ConnectTransportException#node (elastic#80944) Reinterpret dots in field names as object structure (elastic#79922) Remove obsolete typed legacy index templates (elastic#80937) Remove unnecessary shuffle in unassigned shards allocation. (elastic#65172) TSDB: Tests for nanosecond timeprecision timestamp just beyond the limit (elastic#80932) Cleanup SLM History Item .equals (elastic#80938) Rework breaking changes for new structure (elastic#80907) [DOCS] Fix elasticsearch-reset-password typo (elastic#80919) [ML] No need to use parent task client when internal infer delegates (elastic#80905) Fix shadowed vars pt6 (elastic#80899) add ignore info (elastic#80924) Fix several potential circuit breaker leaks in Aggregators (elastic#79676) Extract more standard metadata from binary files (elastic#78754) ...
* upstream/master: (319 commits) Fix typo (elastic#80925) Increase docker compose timeouts for CI builds TSDB: fix error without feature flag (elastic#80945) [DOCS] Relocate `index.mapping.dimension_fields.limit` setting docs (elastic#80964) Explicit write methods for always-missing values (elastic#80958) TSDB: move TimeSeriesModeIT to yaml tests (elastic#80933) [ML] Removing temporary debug (elastic#80956) Remove unused ConnectTransportException#node (elastic#80944) Reinterpret dots in field names as object structure (elastic#79922) Remove obsolete typed legacy index templates (elastic#80937) Remove unnecessary shuffle in unassigned shards allocation. (elastic#65172) TSDB: Tests for nanosecond timeprecision timestamp just beyond the limit (elastic#80932) Cleanup SLM History Item .equals (elastic#80938) Rework breaking changes for new structure (elastic#80907) [DOCS] Fix elasticsearch-reset-password typo (elastic#80919) [ML] No need to use parent task client when internal infer delegates (elastic#80905) Fix shadowed vars pt6 (elastic#80899) add ignore info (elastic#80924) Fix several potential circuit breaker leaks in Aggregators (elastic#79676) Extract more standard metadata from binary files (elastic#78754) ...
This PR adds a new CircuitBreaker implementation in the test that throws CircuitBreakerExceptions randomly. This new circuit breaker helps uncover several places where we might leak if the circuit breaker throws such exception.
A typical case is an object that creates two big arrays in its constructor. This object itself is created in an aggregator constructor. If the circuit breaker throws an exception during the creation of the second array, we need especial code to handle closing the first array or we leak.
This leaks are probably rare and the effect is small but potentially can decrease the performance of a cluster over time.