[
https://issues.apache.org/jira/browse/DERBY-5158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dag H. Wanvik updated DERBY-5158:
---------------------------------
Attachment: DERBY-5158a.stat
DERBY-5158a.diff
Attaching a patch, DERBY-5158a, which corrects the protocol code on the client
side to cater for ENDUOWRM even in the error case (as sent by the server).
Looking at the DRDA standard, I didn't quite manage to satisfy myself that this
is the correct behavior, but almost: section 7.5 Commit/Rollback processing,
where CR2 says:
"Application servers using remote unit of work protocols and application
servers using distributed unit of work but not protected by a sync point
manager must inform the application requester when the current unit of work at
the application server ends as a result of a commit or rollback request by an
application or application requester request. This information is returned in
the RPYDSS, containing the ENDUOWRM reply message."
So, does the above apply when an error happens (the database has already been
shut down, so no connection can be established)? In a way, the "remote unit of
work" is definitely ended, so...
Note that the (new) error stack trace is still different than with the embedded
driver, since there the 08003 will be directly reported as the error (not
wrapped in 06006 as shown below for the client side).
I added a new test, Derby5158Test, not being sure where to put this new test
case (I didn't find any specific tests for commit/rollback), if you know a
better placement for it, let me know! I could always put it in
ShutdownDatabaseTest, I guess..
Running regressions.
With this new code, the following error stack dump can be seen on the client
side, which shows that the underlyinc cause of the error is 08003. "No current
connection".
java.sql.SQLNonTransientConnectionException: A network protocol error was
encountered and the connection has been terminated: the requested command
encountered an unarchitected and implementation-specific condition for which
there was no architected message (additional information may be available in
the derby.log file on the server)
at
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
at
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
at org.apache.derby.client.am.Connection.rollback(Connection.java:659)
at
org.apache.derbyTesting.functionTests.tests.jdbcapi.Derby5158Test.testShutdown(Derby5158Test.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
at junit.extensions.TestSetup.run(TestSetup.java:25)
at
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
at junit.extensions.TestSetup.run(TestSetup.java:25)
Caused by: org.apache.derby.client.am.DisconnectException: A network protocol
error was encountered and the connection has been terminated: the requested
command encountered an unarchitected and implementation-specific condition for
which there was no architected message (additional information may be available
in the derby.log file on the server)
at
org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(NetConnectionReply.java:880)
at
org.apache.derby.client.net.NetConnectionReply.parseRollbackError(NetConnectionReply.java:359)
at
org.apache.derby.client.net.NetConnectionReply.parseRDBRLLBCKreply(NetConnectionReply.java:216)
at
org.apache.derby.client.net.NetConnectionReply.readLocalRollback(NetConnectionReply.java:141)
at
org.apache.derby.client.net.ConnectionReply.readLocalRollback(ConnectionReply.java:48)
at
org.apache.derby.client.net.NetConnection.readLocalRollback_(NetConnection.java:1515)
at
org.apache.derby.client.am.Connection.readRollback(Connection.java:707)
at
org.apache.derby.client.am.Connection.flowRollback(Connection.java:690)
at org.apache.derby.client.am.Connection.rollback(Connection.java:655)
... 28 more
Caused by: org.apache.derby.client.am.SqlException: DERBY SQL error: SQLCODE:
-1, SQLSTATE: 08003, SQLERRMC: No current connection.
... 37 more
> Incomprehensible error message on client if attempting rollback after
> database has been shut down.
> --------------------------------------------------------------------------------------------------
>
> Key: DERBY-5158
> URL: https://issues.apache.org/jira/browse/DERBY-5158
> Project: Derby
> Issue Type: Bug
> Reporter: Dag H. Wanvik
> Priority: Minor
> Attachments: DERBY-5158a.diff, DERBY-5158a.stat, Derby5158Repro.java
>
>
> Cf the attached repro: when performing the rollback after the database has
> been shutdown, we see this error:
> There was 1 error:
> 1)
> testShutdown(org.apache.derbyTesting.functionTests.tests.store.Foo)java.sql.SQLNonTransientConnectionException:
> Network protocol exception: actual code point, 4,692, does not match
> expected code point, 9,224. The connection has been terminated.
> at
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
> at
> org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
> at org.apache.derby.client.am.Connection.rollback(Connection.java:659)
> at
> org.apache.derbyTesting.junit.BaseJDBCTestCase.rollback(BaseJDBCTestCase.java:387)
> at
> org.apache.derbyTesting.functionTests.tests.store.Foo.testShutdown(Foo.java:100)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
> Caused by: org.apache.derby.client.am.DisconnectException: Network protocol
> exception: actual code point, 4,692, does not match expected code point,
> 9,224. The connection has been terminated.
> at
> org.apache.derby.client.net.Reply.parseLengthAndMatchCodePoint(Reply.java:1075)
> at
> org.apache.derby.client.net.NetConnectionReply.parseSQLCARD(NetConnectionReply.java:2572)
> at
> org.apache.derby.client.net.NetConnectionReply.parseRDBRLLBCKreply(NetConnectionReply.java:219)
> at
> org.apache.derby.client.net.NetConnectionReply.readLocalRollback(NetConnectionReply.java:141)
> at
> org.apache.derby.client.net.ConnectionReply.readLocalRollback(ConnectionReply.java:48)
> at
> org.apache.derby.client.net.NetConnection.readLocalRollback_(NetConnection.java:1515)
> at
> org.apache.derby.client.am.Connection.readRollback(Connection.java:707)
> at
> org.apache.derby.client.am.Connection.flowRollback(Connection.java:690)
> at org.apache.derby.client.am.Connection.rollback(Connection.java:655)
> ... 29 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira