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

Disable context propagation when virtual thread is switched to the carrier thread #10854

Merged

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Mar 14, 2024

Hopefully resolves #10747

Copy link
Contributor

@JonasKunz JonasKunz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solution looks great to me!
I still had no lock with trying to reproduce the issue though...

@Moscagus
Copy link

I can reproduce the nested parking problem.
If there is a new snapshot I can try it.
Very good solution to avoid context propagation when there is a switch to carrier thread !!!

@laurit
Copy link
Contributor Author

laurit commented Mar 14, 2024

@Moscagus
Copy link

First I'm going to review your changes.
It is difficult for me to test all the time in production.
Minimally I want to take a look at its changes.

@trask trask added this to the v2.2.0 milestone Mar 14, 2024
@trask trask merged commit 628136e into open-telemetry:main Mar 14, 2024
49 checks passed
@Moscagus
Copy link

@laurit after several consecutive tests I confirm that the solution does not work.
jcmd.txt
jstack.txt

I keep investigating

@laurit laurit deleted the carrier-thread-context-propagation branch March 18, 2024 11:12
@Moscagus
Copy link

@laurit the investigation was always based on the latest version of "VirtualThread.java"
https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/VirtualThread.java
The signatures are:
private void switchToCarrierThread()
private void switchToVirtualThread(VirtualThread vthread)

But in java 21+13:
https://github.com/openjdk/jdk/blob/jdk-21%2B13/src/java.base/share/classes/java/lang/VirtualThread.java
The signatures are:
private boolean switchToCarrierThread()
private void switchToVirtualThread(VirtualThread vthread, boolean notifyJvmti)

Maybe for this reason the "advices" in "VirtualThreadInstrumentation" are never executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Posible deadlock with Java 21 Virtual Threads
4 participants