-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[gRPC + coroutines] Observation to which we're restoring is not the same as the one set as this scope's parent observation #5221
Comments
So we have GRPC and Kotlin here. Can you try to isolate the problem e.g. only to Grpc or Kotlin? |
I can't reproduce this issue using gRPC or Kotlin coroutines, unfortunately 😞 I added additional logging, and I found scope which is not being closed:
This is the one:
|
@marcingrzejszczak Any ideas what we can do to debug this issue? I am happy to help, but I need to know where to start 🙂 |
These kind of problems are the most difficult ones to debug. What you can do is to put a breakpoint inside the SimpleScope that will print the stacktrace when reached. That way you will know who opened the scope and not closed it. |
Describe the bug
Some time ago, I added a change to the micrometer that allowed to pass Observation to a gRPC server using kotlin coroutines, see here.
Recently, a new spring boot was released that contains latest changes in micrometer. I tried to use the new Observation propagation feature, but I observed this strange error:
Unfortunately, it seems that the changes that I made are not working as expected. I've prepared a commit that reproduces the issue, see here.
Here are the logs from test execution:
Environment
java -version
]To Reproduce
How to reproduce the bug:
see [commit]((main...AleksanderBrzozowski:micrometer:support-observation-propagation-for-kotlin-coroutines-grpc-server)
Expected behavior
Seems that the issue is related to
ObservationThreadLocalAccessor.restore
function.Additional context
When observation is not being restored, because a coroutine is not restored, but a new one is started, the issue doesn't happen, see below logs:
The text was updated successfully, but these errors were encountered: