Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PreallocatedCircuitBreakerService leak #72846

Merged
merged 1 commit into from
May 10, 2021

Conversation

iverase
Copy link
Contributor

@iverase iverase commented May 7, 2021

In #66895 we added a circuit breaker that allows pre-allocation of bytes in order to remove hotspots when there are many small allocations happening very fast. Unfortunately it introduced a bug when we overflow the preallocated buffer. In this case we first set the number of bytes and then adjust the breaker. If the breaker trigger at that point, then the preallocated circuit breaker is out of sync and leaks.

This PR changes the order of events, so we first adjust the breaker and then adjust the number of preallocated bytes used.

I have fixed a typo as well: PreallocedCircuitBreaker -> PreallocatedCircuitBreaker

fixes #72760

@iverase iverase requested a review from nik9000 May 7, 2021 10:36
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 7, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@iverase iverase merged commit c16d536 into elastic:master May 10, 2021
@iverase iverase deleted the PreallocatedCircuitBreakerService branch May 10, 2021 05:07
iverase added a commit to iverase/elasticsearch that referenced this pull request May 10, 2021
when overflowing the preallocated buffer, adjust the underlaying breaker
before allocating the preallocated bytes
@iverase iverase added v7.13.1 and removed v7.13.0 labels May 10, 2021
iverase added a commit that referenced this pull request May 10, 2021
when overflowing the preallocated buffer, adjust the underlaying breaker
before allocating the preallocated bytes
iverase added a commit that referenced this pull request May 10, 2021
when overflowing the preallocated buffer, adjust the underlaying breaker
before allocating the preallocated bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.13.0 v7.14.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] CardinalityWithRequestBreakerIT testRequestBreaker failing
5 participants