-
Notifications
You must be signed in to change notification settings - Fork 176
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
JBTM-3734 Replace synchronized with JUCL #2077
Conversation
Thank you very much for your PR @imperatorx! We're in the middle of releasing Narayana 6.0 and, unfortunately, we're not able to use our CI to test your PR. Sorry about that! As soon as we release the major version of Narayana, we'll test and review your PR. |
Is there a JBTM for this one? |
|
@imperatorx How did you track down these potentially long lived pinned threads? The JEP says the diagnostics tool (to help decide whether or not to change instances of synchronized to a lock) is to run with Some of the code you have changed may do I/O which can be "unfriendly" but other code is short lived manipulation of collections so I was wondering why those needed to change. Our code base makes entensive use of synchronized blocks, do you think we need to analyse these many other usages. |
Yes, I've used the
These two classes gave me problems on the hot paths, there might be more. I think for recovery stuff and background work this problem is not really relevant since those task are run in custom threads, e.g. reaper, recovery etc. |
A yes of course, I should have realised. Thanks for the explanation. |
I applied the |
CORE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=CORE,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
AS_TESTS profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=AS_TESTS,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
XTS profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=XTS,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
QA_JTS_OPENJDKORB profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTS_OPENJDKORB,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
JACOCO profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=JACOCO,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
JACOCO profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=JACOCO,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
RTS profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=RTS,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
QA_JTS_OPENJDKORB profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTS_OPENJDKORB,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
TOMCAT profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=TOMCAT,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
LRA profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
AS_TESTS profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=AS_TESTS,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
CORE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=CORE,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
QA_JTA profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTA,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
XTS profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=XTS,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
QA_JTA profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTA,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
LRA profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
TOMCAT profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=TOMCAT,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
PERFORMANCE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=PERFORMANCE,jdk=openJDK17,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
PERFORMANCE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=PERFORMANCE,jdk=openJDK11,label=jnlp-agent/33/): Narayana rebase on main failed. Please rebase it manually |
Started testing this pull request with JACOCO profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=JACOCO,jdk=openJDK11,label=jnlp-agent/190/ |
CORE profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=CORE,jdk=openJDK17,label=jnlp-agent/190/ |
Benchmark output (please refer to the article https://developer.jboss.org/wiki/PerformanceGatesForAcceptingPerformanceFixesInNarayana for information on our testing procedures. If you just want to run a single benchmark then please refer to the README.md file in our benchmark repository at https://github.com/jbosstm/performance/tree/main/narayana For information on the hardware config used for this PR please consult the CI job artefact hwinfo.txt or the job output |
PERFORMANCE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=PERFORMANCE,jdk=openJDK17,label=jnlp-agent/190/): there were regressions in one or more of the benchmarks (see previous PR comment for details |
Started testing this pull request with CORE profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=CORE,jdk=openJDK11,label=jnlp-agent/190/ |
Started testing this pull request with JACOCO profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=JACOCO,jdk=openJDK17,label=jnlp-agent/190/ |
Benchmark output (please refer to the article https://developer.jboss.org/wiki/PerformanceGatesForAcceptingPerformanceFixesInNarayana for information on our testing procedures. If you just want to run a single benchmark then please refer to the README.md file in our benchmark repository at https://github.com/jbosstm/performance/tree/main/narayana For information on the hardware config used for this PR please consult the CI job artefact hwinfo.txt or the job output |
PERFORMANCE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=PERFORMANCE,jdk=openJDK11,label=jnlp-agent/190/): there were regressions in one or more of the benchmarks (see previous PR comment for details |
Started testing this pull request with QA_JTA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTA,jdk=openJDK17,label=jnlp-agent/190/ |
CORE profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=CORE,jdk=openJDK11,label=jnlp-agent/190/ |
TOMCAT profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=TOMCAT,jdk=openJDK17,label=jnlp-agent/190/): Narayana rebase on main failed. Please rebase it manually |
AS_TESTS profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=AS_TESTS,jdk=openJDK17,label=jnlp-agent/190/): Narayana rebase on main failed. Please rebase it manually |
XTS profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=XTS,jdk=openJDK11,label=jnlp-agent/190/ |
XTS profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=XTS,jdk=openJDK17,label=jnlp-agent/190/ |
QA_JTA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTA,jdk=openJDK11,label=jnlp-agent/190/ |
QA_JTA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTA,jdk=openJDK17,label=jnlp-agent/190/ |
AS_TESTS profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=AS_TESTS,jdk=openJDK11,label=jnlp-agent/190/): AS tests failed |
QA_JTS_OPENJDKORB profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTS_OPENJDKORB,jdk=openJDK17,label=jnlp-agent/190/ |
QA_JTS_OPENJDKORB profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=QA_JTS_OPENJDKORB,jdk=openJDK11,label=jnlp-agent/190/ |
JACOCO profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=JACOCO,jdk=openJDK17,label=jnlp-agent/190/ |
JACOCO profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=JACOCO,jdk=openJDK11,label=jnlp-agent/190/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @imperatorx for this contribution and I approve of it and thanks for the explanation of why you changed only a subset of synchronized primitives (#2077 (comment)). Sorry it took us so long to attempt verification. Since the PR changes public APIs we are going to release the change in a major version (7.0.0.Final).
@imperatorx Please can you rebase the PR (it rebases quite easily - just the header in BasicAction). |
6c24f63
to
959c98b
Compare
CORE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=CORE,jdk=openJDK11,label=jnlp-agent/192/): Narayana rebase on main failed. Please rebase it manually |
CORE profile tests failed (https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=CORE,jdk=openJDK17,label=jnlp-agent/192/): Narayana rebase on main failed. Please rebase it manually |
I merged the PR even though the tests failed with a rebase request - the PR does rebase cleanly and the CI run does pass after the merge. |
https://issues.redhat.com/browse/JBTM-3734
Replaced synchronized blocks with reentrantlocks as advised in JEP 425 to support virtual threads.
CORE
Edit:
The synchronized parts were replaced that caused thread pinnings in my own limited tests. These events occured at transaction start and end. To make locking consistent, all synchronized(this) and non-static synchronized methods were replaced in all subclasses of
StateManager
. Additionally, I changed the_syncLock
to be aReentrantLock
inTwoPhaseCoordinator
.This should be enough for basic virtual thread work, although many other subclasses of
StateManager
contain differentsynchronized(someCustomLock)
synchronizations, which will need to be investigated if someone hits thread pinnings on hot paths again.