-
Notifications
You must be signed in to change notification settings - Fork 454
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
[Bug]: Overlapping contexts #1887
Comments
We still don't know the right behavior in this scenario. Would be looking in this. Also, @mladedav if you would like to help here. |
When you say still, does that mean this has been discussed before? I'll try to ask in the spec repo then what should be the bahavior. |
As I read it kind of allows it but we should "identify wrong call order" but it doesn't really say what context should be active after the operation. Since the implementation uses a drop guard, there is no way to return an error. But other implementations should have the same issue with Since the API is optional, I wonder if not providing the API at all would be an option and maybe providing methods such as Otherwise, I guess that the contexts could work as a linked list and if we drop guard for one in the middle we just reconnect its child with its parent but leave the active span as is. Does that sound good? |
Hey @lalitb @mladedav I'm running into this issue as well when looking at tokio tracing and OpenTelemetry Tracing interop. As a reference the Java implementation just drops the offending guard on the floor and logs at the Would this behavior be adequate (yes the state would still be corrupted in some sense, but it is bad behavior), or should we have a proper list/stack and reconnect things? |
If I understand it correctly, it ignores the close call? I don't think that really works since if you have contexts A, B, C, then drop B and that close gets ignored, you can never really close the B context and by extension the A context. |
@mladedav Yes, that's exactly what the Java one does, and that leaves you with a corrupted state. I also think that the proper way would be the better. I'll look into it. |
What happened?
If
ContextGuard
s are dropped out of order, the state may be corrupted. EachContextGuard
restores the last context but that may cause a context different than the root one to be active after allContextGuards
are dropped.The current code assumes that context guards will be dropped in reverse order of their creation. I didn't see anything in the spec saying that this should or shouldn't be assumed. I think this whole report mostly boils to what should be the behavior and whether this should be allowed or the API should be built so that these out-of-order operations were impossible to trigger.
The following is slightly changed
opentelemetry::context::tests::nested_contexts
.API Version
0.23.0, git master
SDK Version
N/A
What Exporter(s) are you seeing the problem on?
N/A
Relevant log output
No response
The text was updated successfully, but these errors were encountered: