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) #72869

Merged
merged 1 commit into from
May 10, 2021

Conversation

iverase
Copy link
Contributor

@iverase iverase commented May 10, 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

backport #72846

when overflowing the preallocated buffer, adjust the underlaying breaker
before allocating the preallocated bytes
@iverase iverase merged commit b958bcd into elastic:7.13 May 10, 2021
@iverase iverase deleted the backport72846-7.13 branch May 10, 2021 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants