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

Error from Metricreader::Collect at shutdown when using PeriodicExportingMetricReader #2056

Closed
timwoj opened this issue Mar 15, 2023 · 1 comment · Fixed by #2064
Closed
Assignees
Labels
bug Something isn't working

Comments

@timwoj
Copy link
Contributor

timwoj commented Mar 15, 2023

Describe your environment
macOS Ventura, otel-cpp 1.8.3

Steps to reproduce
Run the metrics_simple example

What is the expected behavior?
Example should run without error printouts

What is the actual behavior?
During shutdown, the error MetricReader::Collect invoked while Shutdown in progress! is printed.

Additional context
I found this while implementing metrics in a project I work on, but I then discovered that the metrics_simple example does the same.

I’m using a PeriodicExportingMetricReader. An lldb run confirms that PeriodicExportingMetricReader::OnShutDown is being called, but the log message is emitted during the join() call there on the thread. A backtrace shows that OnShutDown is called from MetricReader::Shutdown(), but that doesn’t happen until after MetricReader::shutdown_ is already set to true. If PeriodicExportingMetricReader::OnShutDown does one more call to Collect during the join (which I wouldn’t be surprised if it does), then it’s going to always output that error.

@timwoj timwoj added the bug Something isn't working label Mar 15, 2023
@lalitb lalitb self-assigned this Mar 15, 2023
@lalitb
Copy link
Member

lalitb commented Mar 15, 2023

The PeriodicExportingMetricReader is supposed to do one last metric collect after shutdown is invoked. But you are right, that last collect would never happen, and will fail with the error. This needs to be fixed.

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

Successfully merging a pull request may close this issue.

2 participants