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

Cherry-pick #12600 to 7.2: Fix bug / leak in JS function processors #12604

Merged
merged 1 commit into from
Jun 18, 2019

Conversation

andrewkroh
Copy link
Member

Cherry-pick of PR #12600 to 7.2 branch. Original message:

In an effort to minimize allocations a slice used to hold function arguments is reused rather than allocation new each time a Javascript function processor is used. However there was a typo in re-slicing code so instead of reseting the length to 0 it was a no-op. Hence all future invocations appended to the slice causing a leak. This affects code that uses native Javascript functions in a processor chain (e.g. new process.Chain().Add(function(event) { event.Put("x", "y"); }).Build()).

In an effort to minimize allocations a slice used to hold function arguments is reused rather than allocation new each time a Javascript function processor is used. However there was a typo in re-slicing code so instead of reseting the length to 0 it was a no-op. Hence all future invocations appended to the slice causing a leak. This affects code that uses native Javascript functions in a processor chain (e.g. `new process.Chain().Add(function(event) { event.Put("x", "y"); }).Build()`).

(cherry picked from commit eb06c9a)
@andrewkroh andrewkroh merged commit 50ea375 into elastic:7.2 Jun 18, 2019
@andrewkroh andrewkroh deleted the backport_12600_7.2 branch January 14, 2022 14:06
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
In an effort to minimize allocations a slice used to hold function arguments is reused rather than allocation new each time a Javascript function processor is used. However there was a typo in re-slicing code so instead of reseting the length to 0 it was a no-op. Hence all future invocations appended to the slice causing a leak. This affects code that uses native Javascript functions in a processor chain (e.g. `new process.Chain().Add(function(event) { event.Put("x", "y"); }).Build()`).

(cherry picked from commit f69330a)
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.

2 participants