-
Notifications
You must be signed in to change notification settings - Fork 517
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
processor: Avoid leaking labels between batches #8081
processor: Avoid leaking labels between batches #8081
Conversation
Fixes a bug introduced in elastic#6682 by performing a copy of the `baseEvent` before each of the events is decoded. The event was being shallow copied and it was reusing the same maps between batches. Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
🌐 Coverage report
|
- remove unnecessary channel waitc - add numeric label in metadata, also. this triggers a leak in the following events' NumericLabels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explanation for why we need this makes sense, as does why this is only seen when metadata labels exist (the apmevent that is getting copied now has a shared map that doesn't get reset). I still don't know how it worked before, but I'll see if I can make sense of it.
We used to clone the labels when merging, which got removed: https://github.com/elastic/apm-server/pull/6682/files#diff-b3024df769ff9c30ace55348c1326f0cfd0bcc32e819705a2f51255f50ccb9a1L56 This PR is re-introducing that behavior, but in a more obvious way. |
/test |
Fixes a bug introduced in #6682 by performing a copy of the `baseEvent` before each of the events is decoded. The event was being shallow copied and it was reusing the same maps between batches. The linked PR changed the behavior (although not in a very obviously) and was instead merging the labels onto the passed `APMEvent`. This patch reintroduces the previous behavior in a more obvious manner. Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com> Co-authored-by: stuart nelson <stuartnelson3@gmail.com> (cherry picked from commit b782e9e) # Conflicts: # changelogs/head.asciidoc
#8086) * processor: Avoid leaking labels between batches (#8081) Fixes a bug introduced in #6682 by performing a copy of the `baseEvent` before each of the events is decoded. The event was being shallow copied and it was reusing the same maps between batches. The linked PR changed the behavior (although not in a very obviously) and was instead merging the labels onto the passed `APMEvent`. This patch reintroduces the previous behavior in a more obvious manner. Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com> Co-authored-by: stuart nelson <stuartnelson3@gmail.com> (cherry picked from commit b782e9e) # Conflicts: # changelogs/head.asciidoc * Delete head.asciidoc Co-authored-by: Marc Lopez Rubio <marc5.12@outlook.com> Co-authored-by: stuart nelson <stuartnelson3@gmail.com>
Verified with the reproduction steps in
|
Motivation/summary
Fixes a bug introduced in #6682 by performing a copy of the
baseEvent
before each of the events is decoded. The event was being shallow copied
and it was reusing the same maps between batches.
The linked PR changed the behavior (although not in a very obviously)
and was instead merging the labels onto the passed
APMEvent
. Thispatch reintroduces the previous behavior in a more obvious manner.
Checklist
- [ ] Update package changelog.yml (only if changes toapmpackage
have been made)- [ ] Documentation has been updatedHow to test these changes
docker-compose up -d
and install the APM Integrationmake && ./apm-server -E output.elasticsearch.username=admin -E output.elasticsearch.password=changeme -E apm-server.expvar.enabled=true -e
curl -H "Content-type: application/x-ndjson" --data-binary @testdata/intake-v2/events.ndjson http://localhost:8200/intake/v2/events
Related issues