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
Do not null the actual connection when delaying close. That means whe… #1022
Conversation
46a955c
to
cbfc39b
Compare
I've noticed a few commits like this which don't appear to have associated JIRAs. Am I missing something? |
Generally they are likely to be speculative ones. Occasionally "CI" ones might not have a Jira (i.e. the ones that AMS2 runs for us). This one in particular has not been cleared for release into the code as I am not 100% on the strategy yet. I am just running CI on it to verify it does not break anything. |
OK. Was looking for a JIRA which might explain what the issue was. What's the plan to address that aspect, i.e., speculative issues which don't (appear to) have descriptions on the (speculative) issue and hence can't solicit input from the wider team/community? Or would the plan be to escalate to a full JIRA if going beyond speculation and then asking for input? |
Precisely. At the moment I am working out if the change that makes the other project work, breaks our CI. Then I will look more closely at the change to see if it makes sense to make the change or make the dependent project change (i.e. is a bug in Narayana, enhancement in Narayana or bug in the third party project). Finally I will either create a forum post or an issue (depending on whether its an enhancement, bug or whatever). For now I have just added the "hold" label to show this incomplete state - I should have done that before. |
cbfc39b
to
609231e
Compare
609231e
to
57ec140
Compare
2912b58
to
075c7c8
Compare
Started testing this pull request with QA_JTA profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTA,jdk=jdk8.latest,label=linux/6/ |
Started testing this pull request with MAIN profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/6/ |
Started testing this pull request with QA_JTS_JDKORB profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTS_JDKORB,jdk=jdk8.latest,label=linux/6/ |
http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/6/ using non-default AS_BRANCH: |
MAIN profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/6/ |
QA_JTA profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTA,jdk=jdk8.latest,label=linux/6/ |
QA_JTS_JDKORB profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTS_JDKORB,jdk=jdk8.latest,label=linux/6/ |
@@ -125,13 +124,14 @@ public void beforeCompletion() { } | |||
public void afterCompletion(int status) { | |||
try { | |||
connectionToTest.isClosed(); | |||
connectionToTest.close(); |
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.
Not sure about that. This test is specifically for isClosed method. Close method is tested by closeConnectionInAfterCompletion.
I did that on purpose to make test units as small as possible.
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.
Sure, but its part of spec that you have to call connection.close if you call getConnection. I can move it out of the verify I think
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.
Yeah. I can. I will move it down so it doesn't look wrong for the test
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 connection wasn't really opened. xaDataSource is a mock, so instead of creating a connection it returns a mock connection.
Also message in the catch block is a bit misleading since you've removed close statement.
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 message.
RE connection.close() I am not sure if you are saying it doesn't matter because we are using a mock in which case I would disagree because someone might change it from a mock to a real connection in the future and then it would break. OTOH aybe you are saying even with a real connection you would not need the .close in which case I can remove it.
I do see from the rest of your tests that you do have the .close()
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.
OK, I will just add the comment then
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.
Hmm, as you can see from the diff I have made the change you requested to not close connection however in doing so there is an issue that the close functionality is not executed:
https://github.com/tomjenkinson/narayana/blob/bcc7c01599e46fcd5e5412ce9277bda62146ddb0/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java#L388
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.
Did you have change to review this yet? I wonder about if adding the .close would also be useful if we in the future added pooling to ConnectionImpl. By not calling .close we would leak the connection not just from ConnectionManager but also this hypothetical pool.
Thanks!
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.
Sorry, I didn't get a notification for some reason...
We would leak in the real application. But this is a unit test which doesn't use real connections. There is nothing to leak.
I'm not sure what you mean by close not being executed. Why would isClose execute it? You should check for closeImpl execution in closeConnectionInAfterCompletion test.
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.
Hi gytis, I don't think I am being clear here. The connection we would leak would be a ConnectionImpl.
But lets not talk hypothetical. If this test does not call connection.close() then the following line is not called: https://github.com/tomjenkinson/narayana/blob/bcc7c01599e46fcd5e5412ce9277bda62146ddb0/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java#L388
* own implementation! | ||
*/ | ||
|
||
public class SupportsMultipleConnectionsModifier implements XAModifier, ConnectionModifier { |
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.
Here and in some other places tab is used to indent rather than a space.
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.
Well, we don't normally worry about the code format but I will reformat with IntelliJ and see how that comes out
2a7f56b
to
f541be8
Compare
I just internationalized the log messages too |
Started testing this pull request with QA_JTS_JDKORB profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTS_JDKORB,jdk=jdk8.latest,label=linux/11/ |
Started testing this pull request with MAIN profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/11/ |
Started testing this pull request with QA_JTA profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTA,jdk=jdk8.latest,label=linux/11/ |
http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/11/ using non-default AS_BRANCH: |
MAIN profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/11/ |
QA_JTA profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTA,jdk=jdk8.latest,label=linux/11/ |
QA_JTS_JDKORB profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTS_JDKORB,jdk=jdk8.latest,label=linux/11/ |
38ddc13
to
bcc7c01
Compare
Started testing this pull request with QA_JTA profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTA,jdk=jdk8.latest,label=linux/13/ |
Started testing this pull request with QA_JTS_JDKORB profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTS_JDKORB,jdk=jdk8.latest,label=linux/13/ |
Started testing this pull request with MAIN profile: http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/13/ |
http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/13/ using non-default AS_BRANCH: |
MAIN profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=MAIN,jdk=jdk8.latest,label=linux/13/ |
QA_JTA profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTA,jdk=jdk8.latest,label=linux/13/ |
QA_JTS_JDKORB profile tests passed - Job complete http://narayanaci1.eng.hst.ams2.redhat.com/job/btny-pulls-narayana-jdk8/PROFILE=QA_JTS_JDKORB,jdk=jdk8.latest,label=linux/13/ |
bcc7c01
to
d2ac4aa
Compare
As agreed on HipChat I have made the change to use a ConnectionImple (rather than java.sql.Connection) and @gytis agreed I should merge it after that. |
https://issues.jboss.org/browse/JBTM-2676
!BLACKTIE !XTS !PERF