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 leak in Jaeger exporter #1160

Merged
merged 2 commits into from
Dec 23, 2021

Conversation

bjosv
Copy link
Contributor

@bjosv bjosv commented Dec 21, 2021

During our introduction of Jaeger and using the JaegerExporter we found this memory leak.
There is currently no unittest for the JaegerExporter in opentelemetry-cpp that could have caught this, but maybe we should add something similar to the ongoing ZipkinExporter test (#1155)?

Changes

The jaeger_span was never destroyed after its release from the JaegerRecordable.
This change let a std::unique_ptr handle the destruction when going out of scope, first allowing thethrift::Span to be copied to the span_buffer_.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@bjosv bjosv requested a review from a team December 21, 2021 22:39
Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix.
Agree, Jaeger exporter tests need to be improved.

@codecov
Copy link

codecov bot commented Dec 22, 2021

Codecov Report

Merging #1160 (33c2bfb) into main (dcea27b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1160   +/-   ##
=======================================
  Coverage   93.38%   93.38%           
=======================================
  Files         165      165           
  Lines        6233     6233           
=======================================
  Hits         5820     5820           
  Misses        413      413           

Copy link
Member

@esigo esigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix.
LGTM.
I will add more tests without mock to cover Thrift part.

@bjosv
Copy link
Contributor Author

bjosv commented Dec 22, 2021

I will add more tests without mock to cover Thrift part.

Great! Was thinking of looking into this, but just let me know If I can be of any help.

@esigo esigo mentioned this pull request Dec 22, 2021
3 tasks
@esigo
Copy link
Member

esigo commented Dec 22, 2021

We can catch the leak in the new test.

@lalitb
Copy link
Member

lalitb commented Dec 23, 2021

@bjosv - can you update the branch to main, to allow this to be merged.

The jaeger_span was never destroyed after its release from the
JaegerRecordable. This change let a `std::unique_ptr` handle
the destruction when going out of scope, first allowing the
`thrift::Span` to be copied to the `span_buffer_`.
@bjosv
Copy link
Contributor Author

bjosv commented Dec 23, 2021

@lalitb The PR has now been updated to the latest from main.

@bjosv
Copy link
Contributor Author

bjosv commented Dec 23, 2021

CI step Bazel on MacOS failed with
ERROR: Analysis of target '//exporters/elasticsearch:es_log_exporter_test' failed; build aborted: Analysis of target '@local_config_cc//:tvos_x86_64' failed

It doesn't seem to be related to my correction according to the output, but I'm not familiar with the test.

@lalitb lalitb merged commit de276f5 into open-telemetry:main Dec 23, 2021
@bjosv bjosv deleted the fix-leak-jaeger-exporter branch December 27, 2021 09:17
@ThomsonTan
Copy link
Contributor

Thanks for catching and fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants