-
Notifications
You must be signed in to change notification settings - Fork 177
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-3911 Replace synchronized in favor of Reentrant Lock in LRAService joinLRA method #2293
Conversation
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/481/ |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/481/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/481/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/481/ |
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
public class LRAWithParticipantsTest { |
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.
@marcosgopen this is very much like copy-paste of LRATest. Refactor it so we don't need to always change the same thing in two different classes please.
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 Martin, I cleaned and refactored the test.
@@ -328,7 +328,7 @@ public int leave(URI lraId, String compensatorUrl) { | |||
} | |||
} | |||
|
|||
public synchronized int joinLRA(StringBuilder recoveryUrl, URI lra, long timeLimit, | |||
public int joinLRA(StringBuilder recoveryUrl, URI lra, long timeLimit, |
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.
As we discussed offline, I'm not sure what all the possible implications of removing synchronized from this method could be. I would like to hear from @mmusgrov why it was synchronized in the first place.
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.
Good idea, I put the on hold label.
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.
@marcosgopen I added a comment to the JBTM indicating that the tests are good but I'm not convinced that removing the monitor is the correct approach. Personally I would keep the tests but withdraw the fix and work on a different fix for the lock contention, do you mind if I look into the alternate approach?
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.
I updated the PR, I am still removing the synchronized but adding the ReentrantLock during the enlistment. Could you have a look at this solution @mmusgrov ?
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.
The general technique used in the PR is a good one to break the lock contention. I did have some comments about other parts of the PR though so I have asked for changes.
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/482/ |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/482/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/482/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/482/ |
@@ -328,7 +328,7 @@ public int leave(URI lraId, String compensatorUrl) { | |||
} | |||
} | |||
|
|||
public synchronized int joinLRA(StringBuilder recoveryUrl, URI lra, long timeLimit, | |||
public int joinLRA(StringBuilder recoveryUrl, URI lra, long timeLimit, |
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.
@marcosgopen I added a comment to the JBTM indicating that the tests are good but I'm not convinced that removing the monitor is the correct approach. Personally I would keep the tests but withdraw the fix and work on a different fix for the lock contention, do you mind if I look into the alternate approach?
That works for me @mmusgrov , I put the on hold label and I will re-adapt the PR so to keep only the test. |
217fd5f
to
25e40e5
Compare
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/483/ |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/483/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/483/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/483/ |
25e40e5
to
7d2db7d
Compare
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/484/ |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/484/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/484/ |
@@ -90,7 +90,8 @@ public void lraMBean() throws Exception { | |||
|
|||
@Test | |||
public void lraMBeanRemoval() throws Exception { | |||
LongRunningAction lra = new LongRunningAction(new Uid()); | |||
String lraUrl = "http://localhost:8080/lra"; |
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.
Previous way of creating the LRA was not working anymore, lraID was not initialized and therefore was causing a NullPointerException at https://github.com/jbosstm/narayana/blob/main/rts/lra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/service/LRAService.java#L107. So changing how it is initialized.
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.
The NullPointerException path from tryLockTransaction(URI) that I observed was during the addition of tryLockTransaction needed for enlistParticipant so I expect changing this test is OK. Although the LongRunningAction(Uid) constructor is added for MBean listing, it is used here to initialize a useable LongRunningAction and so it is reasonable to change it to use one of the constructors that appear expected for that purpose.
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.
I will take a look next week (I'm on PTO today but wanted to get this PR reviewed asap).
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.
But don't let this comment block the PR.
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.
The constructor should only be used when loading an LRA from the ObjectStore. So after constructing the LRA the expectation is that restore_state will be called so that the URI for the LRA gets initialised. Clearly the code is brittle so it would be nice to firm it up in this area - I have raised JBTM-3919 so that we don't loose site of it.
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 Mike!
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/484/ |
7d2db7d
to
3905dc7
Compare
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/486/): narayana build failed |
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/486/): narayana build failed |
bb500ee
to
888ab39
Compare
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/487/ |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/487/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/487/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/487/ |
...ra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/model/LongRunningAction.java
Show resolved
Hide resolved
...ra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/model/LongRunningAction.java
Outdated
Show resolved
Hide resolved
...ra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/model/LongRunningAction.java
Show resolved
Hide resolved
if (participant != null) { | ||
participant.setCompensatorData(compensatorData); | ||
return participant; // must have already been enlisted | ||
long timeLimit, String compensatorData) throws UnsupportedEncodingException { |
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.
Superfluous reformatting.
...ra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/model/LongRunningAction.java
Show resolved
Hide resolved
rts/lra/service-base/src/main/java/io/narayana/lra/logging/LraI18nLogger.java
Outdated
Show resolved
Hide resolved
@marcosgopen Will you also squash the commits prior to merging please. |
888ab39
to
ff5660c
Compare
@mmusgrov PR updated and commits squashed. Thanks for your review. |
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.
PR looks good, sorry for not explaining ERROR vs WARN logging levels more clearly.
+1 clearer titles and descriptions help a lot to ease the "cognitive burden". |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/489/ |
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/489/): LRA Test failed with failures in no_arq profile |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/489/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/489/ |
ff5660c
to
32f16a7
Compare
32f16a7
to
d9dfdd2
Compare
in LRAService joinLRA method
d9dfdd2
to
fd44514
Compare
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/494/ |
Started testing this pull request with LRA profile: https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/494/ |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK11,label=jnlp-agent/494/ |
I investigated the reason of the failure and, long story short, this is not related to this PR. |
LRA profile tests passed - Job complete https://ci-jenkins-csb-narayana.apps.ocp-c1.prod.psi.redhat.com/job/btny-pulls-narayana/PROFILE=LRA,jdk=openJDK17,label=jnlp-agent/494/ |
https://issues.redhat.com/browse/JBTM-3911
previous title was 'Remove redundant lock monitor from LRAService'
!CORE !AS_TESTS !RTS !JACOCO !XTS !QA_JTA !QA_JTS_OPENJDKORB !PERFORMANCE LRA !DB_TESTS