Replies: 2 comments 3 replies
-
As this is relative to the previous change, @devkanro could you take a look here? @h0cheung TBO, I am not familiar with the way you used through gRPC. The new thread is created by yourself, and I am not sure whether the plugin could adopt that. |
Beta Was this translation helpful? Give feedback.
3 replies
-
I tried to change the codes like this, is this fitting your use case? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Search before asking
Apache SkyWalking Component
Java Agent (apache/skywalking-java)
What happened
If StreamObserver#onNext is called in another thread, we will see exception:
IllegalArgumentException("ContextSnapshot can't be null.")
After apache/skywalking-java#457, we use a
io.grpc.Context
to pass theContextSnapshot
. But by default,io.grpc.Context
usesThreadLocal
as storage. So it won't work across threads. Then the contextSnapshot will be null, which causes the exception above.I think we should partially revert the PR. Using the constructor to pass contexts is good.
What you expected to happen
It should work normally
How to reproduce
the simplest way is write a handler like this:
Then call it with a client, such as grpcurl.
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions