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

Thread leak in BatchLogRecordExportProcessor (and probably in all BatchExportProcessor) #5355

Closed
pitming opened this issue Feb 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pitming
Copy link

pitming commented Feb 13, 2024

Bug Report

List of all OpenTelemetry NuGet
packages
and version that you are
using (e.g. OpenTelemetry 1.0.2):
OpenTelemetry.Exporter.InMemory 1.6.0-rc.1
OpenTelemetry.Api 1.6.0-rc.1
OpenTelemetry.Extensions.Hosting 1.6.0-rc.1
OpenTelemetry.Instrumentation.Process 0.5.0-beta.3
OpenTelemetry.Instrumentation.Runtime 1.5.0
OpenTelemetry.SemanticConventions 1.0.0-rc9.9
OpenTelemetry.Exporter.OpenTelemetryProtocol 1.6.0-rc.1

Runtime version (e.g. net462, net48, netcoreapp3.1, net6.0 etc. You can
find this information from the *.csproj file):
net7.0

Symptom

In BatchExportProcessor, a thread is created and started in the constructor. That thread is a while(true) that never stop while the BatchExportProcessor exists.
when configuring otel for logging, if you give a Configuration Object that is refreshed when the config changes, the full config is re run creating more and more threads

so to be more clear in the startup:

serviceCollection.AddLogging(logging =>
{
 logging.AddOpentelemetry(options => options.AddOltpExporter(p=>p.Endpoint = otelConfiguration.ExporterEndpoint)
});

If the otelConfiguration object is refreshed (because let's say we did change the content of the appsettings.json), then a new thread is created

What is the expected behavior?

Only one thread for the BatchEportProcessor

What is the actual behavior?

the more the configuration is refreshed, the more thread are created

Reproduce

https://github.com/pitming/otelThreadLeak

We will close this issue if:

  • The repro project you share with us is complex. We can't investigate custom
    projects, so don't point us to such, please.
  • If we can not reproduce the behavior you're reporting.

Additional Context

Here you see the amount of thread growing and growing
image

@pitming pitming added the bug Something isn't working label Feb 13, 2024
@pitming
Copy link
Author

pitming commented Feb 14, 2024

I don't reproduce with the 1.7 version

@pitming pitming closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant