Bug 1516950
| Summary: | Data inconsistency for CMR when connection is broken on oracle.jdbc.ReadTimeout Timeout after database resource commits | ||
|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | Radek Rodak <rodakr> |
| Component: | JCA | Assignee: | jboss-set |
| Status: | CLOSED NOTABUG | QA Contact: | Jiří Bílek <jbilek> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.4.0 | CC: | jpederse, kkhan, myarboro, ochaloup, rodakr, tom.jenkinson |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1181132 | Environment: | |
| Last Closed: | 2017-12-19 09:56:56 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Radek Rodak
2017-11-23 16:24:06 UTC
Hi Radek, Tom asked me to investigate on this issue and I have few questions to check with you. I have created some reproducer, trying to understand the issue but I'm not 100% successful. I do not understand exact scenario that causes the data inconsistency. Would you be so kind and elaborate a bit more on it? Referring to your post at the https://bugzilla.redhat.com/show_bug.cgi?id=1181132 If I understand you could see the issue at two cases, am I right? Those are what you says at bz#1181132 * 'We are hitting exactly this case with CMR on Oracle Datasource, where we are getting RMFAIL when Oracle Database is shutdown with "shutdown immediate"' * 'I have put oracle.jdbc.ReadTimeout Property on CMR Datasource, I saw this Exceptions, when ReadTimeout has closed JDBC Connection' Maybe they are two different issues (each for each case)? For the second case - is that that during SQL update/insert execution the read timeout is lower than the time needed to execute and the execution is rejected. Then you get 'java.sql.SQLRecoverableException: IO Error: Socket read timed out', which results to global transaction is set up 'TwoPhaseOutcome.FINISH_ERROR'. Here from my testing here the whole transactions with all resources is aborted. Which is correct. There are only some errors in the log. Do you have experience that the IBM MQ is (in this read timeout case) committed? If I understand right the case where Oracle Database is shutdown with "shutdown immediate", the behavior is as expectd (heuristic rollback is reported, manual resolution is needed but that's what is the CMR capability to do). And you resolved the issue of need to manually resolve branch by using XA, right? Thank you for you input Ondra Hi Ondrej Only thing need to be done is just to add Error Code Number to private static final List<String> RMFAIL_SQL_ERRORCODES in core/src/main/java/org/jboss/jca/core/tx/jbossts/LocalConnectableXAResourceImpl.java for java.sql.SQLRecoverableException: IO Error: Socket read timed out. ( you need to check which number it is ) This should be good enough, because it works already for Oracle: 08000 (No more data to read from socket) With CRM, Global Transaction in 2-end Phase needs to end up with XAException.XAER_RMFAIL with CMR Ressource and not automatic Rollback, because it can also be, that Oracle was able commit short before connection is gone. Analog what Tom did here https://github.com/ironjacamar/ironjacamar/pull/278/commits/ff62b8b23f59f9fbb9c15be40fef38efb872c436 What is more difficult is to create reproducer for this.... What you need to do is to throw System Exception "java.sql.SQLRecoverableException: IO Error: Socket read timed out" in 2-end Phase with CMR Datasource, and you should get throw new LocalXAException(bundle.couldNotCommitLocalTx(), XAException.XAER_RMFAIL, re); and not Rollback. The reproducer should find also Transaction in status "Heuristic" is store, after Periodic Recovery has run. ... sorry typo... instead CRM, it should be CMR :-) and if same happened in 1-phase before 2-end phase, you should NOT have XAException.XAER_RMFAIL but Rollback... I'm not sure were exactly there is boundary, I think Tom know it by heart :-) Hi Radek, thank you for the explanation. I think I've created this kind of reproducer. And everything works just fine. Can you please tell me what is JBoss version you work with? (what is the jboss version this bug is reported against) Btw. The Tom's pull request: https://github.com/ironjacamar/ironjacamar/pull/278 was not accepted and IronJacamar handles the errors in the extension (needed to be defined in xa-datasource configuration which you have, as I can see): https://github.com/ironjacamar/ironjacamar/blob/1.4/adapters/src/main/java/org/jboss/jca/adapters/jdbc/extensions/oracle/OracleExceptionSorter.java#L59 (branch 1.4 is in EAP 7.1, branch 1.0 is in JBoss EAP 6.4 - https://github.com/ironjacamar/ironjacamar/blob/1.0/adapters/src/main/java/org/jboss/jca/adapters/jdbc/extensions/oracle/OracleExceptionSorter.java) Agree that in 1-phase there should be got the rollback. That's something I haven't checked but it works for before 1-phase fine (that is what I was playing with). Thank you again Ondra Enliste IBM MQ Ressource have to be set to full XA, only one Ressource in Global Tx can be used with CMR. Which means IBM MQ JMS Connection Factory need to have transaction parameter set to XA ( LocalTransaction would be wrong for this case ). There is also an issue with IBM MQ Client Version, before IBM MQ 7.5.0.6, I tested it with IBM MQ wmq rar from 7.5.0.8. With older Version in some cases there is an issue with uncommited Messages on IBM MQ QueueManager side, even after XA timeout ... I used EAP 6.4.17... you need at least 6.4.9 I thing, to have the fix from Tom which does the XAException.XAER_RMFAIL for for Oracle: 08000 (No more data to read from socket) Thanks you for the hint... I was not following what happend to Tom's commit after.
You right, there is even more codes inside OracleExceptionSorter.isExceptionFatal()
.... oh looks like this case is already inside :-)
if ((errorCode < 20000 || errorCode >= 21000) &&
((errorText.indexOf("SOCKET") > -1)
... now the Question is if errorCode for "java.sql.SQLRecoverableException: IO Error: Socket read timed out"
is NOT between 20000 - 21000 .... because if errorCode will be in this range, isExceptionFatal will return false and not true...
Mabe you have to ask jesper, what he thinks :-)
Cheers Radek
if the errorCode is not in rage 20000 - 21000 , then reproducer should already work without any changes to source code. :-) in this case in 2-end phase you should see Heuristic Transaction on "java.sql.SQLRecoverableException: IO Error: Socket read timed out" and not Rollback :-) And if it works, we can close this ticket with, "java.sql.SQLRecoverableException: IO Error: Socket read timed out" already correctly handled with CMR :-) Ok, I see. The XAException.XAER_RMFAIL should be thrown for the Oracle error code '08000' from EAP 6.4.0.GA release (https://github.com/ironjacamar/ironjacamar/commit/7fda1ec4b40031e93a40482fa9eeb82c6a41ae49). You need to have defined the ExceptionSorter in the xa datsource configuration (<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>). The error code that you looks for is here (I think) https://github.com/ironjacamar/ironjacamar/blob/1.0/adapters/src/main/java/org/jboss/jca/adapters/jdbc/extensions/oracle/OracleExceptionSorter.java#L87 The scenario you describe works fine for me. I tend to think that this issue could be closed, if you agree. Thanks Ondra I'm closing this as my investigation indicates this is not a bug. Radek, please, feel free to reopen or create new issue if shows otherwise. |