-
Notifications
You must be signed in to change notification settings - Fork 298
Java virtual threads locked up / parking / permanently blocking -- swap synchronized block for reentrant lock #339
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
base: POOL_2_X
Are you sure you want to change the base?
Conversation
|
Hello @Brian1KB Thank you for your report. Please add a unit test to this PR. |
To add a unit test, I'd need to include a |
Untested, but I'd expect something like this would suffice. |
|
Hi @garydgregory, could you or anyone else please help/guide @Brian1KB about tests? On a side note, this PR changes the locking mechanism to use Java |
|
Is there anything I can help with to make it merged and released? We are eager to use Jedis with Virtual Threads and we cannot do this without this fix and then a release of Jedis with this dependency updated! |
|
I second @sazzad16 's plea for assistance – @garydgregory could this be merged without additional unit tests, as this behavior is already covered by preexisting tests? |
|
Hello all and @psteitz My view here is twofold:
|
|
Hi everyone, I'd like to know if there has been any progress on this issue? I'm encountering this problem on JDK 21, causing my platform threads to expand infinitely. |
|
Hi @funky-eyes See my previous comments. With JEP 491 in JDK 24, a significant improvement has been made regarding virtual threads and synchronized blocks. Virtual threads can now acquire, hold, and release monitors independently of their carriers. How is your use case on Java 24? |
Hi garydgregory First, thank you for your reply. Second, our application upgrades require strict evaluation and testing, so this is quite time-consuming and labor-intensive work. Moreover, JDK 24 is not an LTS version, and we need to wait for JDK 25. Although I have already verified in JDK 24 that there are no pinned threads, I believe the community should consider users on JDK 21. Furthermore, based on the scope of changes in this PR, I don't think it would negatively impact the core code. |
|
So this not an issue anymore in JDK 24? |
This PR resolves an actively occurring issue with virtual threads that is easily reproducible. If you call borrowObject within the GenericObjectPool at a high rate in a short period of time with virtual threads, all of the threads within the ForkJoinPool for virtual threads will lock up & park, and no virtual threads will resume.
I've already seen there is another Loom related PR that has existed for over a year, and I hope that including this demonstration of a production issue will hope speed up the process for getting this resolved. The demo will print "attempting to acquire", but never "acquired". If you apply my PR, this issue is resolved -- in addition, it passes all existing unit tests.
I'm confident that there are other similar issues within the project, though I would sure imagine that the maintainers would have a better idea of where to look for such problems. Additionally, I'm confident this is not the correct branch to PR to, and if I could have I would've filed an issue instead & left this part to more competent hands, but the sign up process for the JIRA was too complex, and figuring out how to use a mailing list might be more complex for me than debugging this issue was.