-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
OpenTelemetry Scope not closed correctly #25102
Comments
/cc @radcortez |
Is this still an issue or has it been addressed by the various fixes that have occurred over time? |
@geoand Google brought me to this issue because I got the same warning as above. I'm not sure if it's relevant or not. I made a small reproducer to force the Quarkus instance to use one thread, and then I triggered a context switch for that thread to see if the traceID propagates correctly: @Path("/hello")
class ExampleResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
suspend fun hello(): String {
println("${LocalTime.now()} ${Thread.currentThread().name}: ${Span.current().spanContext.traceId}")
delay(3000)
println("${LocalTime.now()} ${Thread.currentThread().name}: ${Span.current().spanContext.traceId}")
return "hello"
}
} This produces the following, after I called it twice in quick succession:
Fortunately, the context trace id is switched appropriately. I had some issues on my project because the old, "soon-to-be-deprecated" OpenTracing failed to do the context switch and would always keep the latest traceId. I'm not sure if this helps with the issue at hand. |
This last issue is related with the OTel context storage and restore. This is not specific to Baggage. |
Is there anything we need to do for this one or can it be closed? |
So I'm seeing this during a ui regression test run with Quarkus 3.3.2., even after I managed to get rid of the OTLP export timeout issues (see #35686). |
What were you expecting to see, @famod, this message? -> |
@brunobat I am seeing this warning multiple times but I don't see any hints of exceptions.
So I basically want to get rid of those warnings. |
We should create a set of tests that replicate the scope closing issue and go from there... |
In the meantime, would it make sense to add more info to that warning? Something to correlate which context wasn't closed correctly? |
yes, @famod. Will do |
Thanks @brunobat! I started looking at those now extended warning messages and so far, all logged "previous" traceids point to perfectly valid, non-erroneous REST calls. So for now I don't see what the problem is. |
Do you have an idea of the percentage of spans that get the warning? |
@brunobat I see these randomly in our tests using 3.5.3. I've just cleaned our build to filter all expected error and warning logs and these are left behind; unfortunately I can't say when they began. They seem to be very random, with hundreds of Here's an example:
|
I have the same issue, found out that I have thise errors when the client abort the connection after sending the request. |
A reproducer I created for another issue reproduces this issue. |
Thanks @computerlove, Will take a look |
The fix for this issue will take while due to bandwidth. Will reduce the log from info to warn because it's causing issues in prod systems. |
I did run into this while trying to reproduce #35686 |
This happens when multiple spans are open and they don't close in the right order. This requires an overhaul of the way we handle span scopes and will be handled while we introduce the Observation API, @geoand |
Understood, thanks. |
Possibly another useful data point, I consistently see this after agroal does some work. Logs show jumping from executor-thread-n to agroal-n and then back and it happens immediately, I assume when the non-blocking query returns. |
Describe the bug
This issue originated on the following discussion: #23882
I am opening it to keep track here.
When using Baggage propagation, the Scope is not closed correctly.
In the log, we can see the following warning:
WARN [io.qua.ope.run.QuarkusContextStorage] (vert.x-eventloop-thread-7) Context in storage not the expected context, Scope.close was not called correctly.
Expected behavior
Not showing the warning. If it is harmless, as a workaround I think we can just ignore the log using quarkus.log.category.
Actual behavior
No response
How to Reproduce?
Reproducer: https://github.com/fabrii/quarkus-playground/tree/opentelemetry
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.7.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: