db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data
Date Fri, 19 Nov 2010 20:26:17 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Hillegas updated DERBY-4315:
---------------------------------

    Attachment: derby-4315-01-ab-regularizeExceptionHandling.diff

Attaching a second rev of this initial patch, derby-4315-01-ab-regularizeExceptionHandling.diff.
The tests ran cleanly except for a suspicious error in NetworkServerMBeanTest. I have revamped
the patch to improve error messages for the cases touched by this patch. I will re-run the
tests.

The error messages no longer falsely claim that a protocol error occurred. In addition, I
tried to clarify the description of how the client driver recovers from the exception.

This is the suspicious error I saw in NetworkServerMBeanTest. When I ran the test standalone,
I saw no errors. However, we know from past experience that NetworkServerMBeanTest is sensitive
to interference from tests which run before it:

1) testAttributeAccumulatedConnectionCount(org.apache.derbyTesting.functionTests.tests.management.NetworkServerMBeanTest)java.security.PrivilegedActionException:
javax.management.InstanceNotFoundException: org.apache.derby:type=NetworkServer,system=c013800d-012c-658f-2b31-ffffe1d7aa3e
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.derbyTesting.functionTests.tests.management.MBeanTest.getAttribute(MBeanTest.java:379)
	at org.apache.derbyTesting.functionTests.tests.management.NetworkServerMBeanTest.testAttributeAccumulatedConnectionCount(NetworkServerMBeanTest.java:93)
	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:109)
	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)
	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)
Caused by: javax.management.InstanceNotFoundException: org.apache.derby:type=NetworkServer,system=c013800d-012c-658f-2b31-ffffe1d7aa3e
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1010)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:627)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:659)
	at org.apache.derbyTesting.functionTests.tests.management.MBeanTest$4.run(MBeanTest.java:382)
	... 41 more

FAILURES!!!
Tests run: 8871,  Failures: 0,  Errors: 1

----------------

Touches the following files:

M      java/engine/org/apache/derby/loc/messages.xml
M      java/shared/org/apache/derby/shared/common/reference/SQLState.java
M      java/client/org/apache/derby/client/net/Request.java


> Attempt to reuse streams in client on insert gives protocol exception and inserts wrong
data
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4315
>                 URL: https://issues.apache.org/jira/browse/DERBY-4315
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.6.1.0
>            Reporter: Kathey Marsden
>         Attachments: derby-4315-01-aa-regularizeExceptionHandling.diff, derby-4315-01-ab-regularizeExceptionHandling.diff,
ReproReuseStream.java, ReproReuseStream.java, StreamError.java
>
>
> If a user attempts to reuse a stream set as a parameter to a prepared statement, the
statement execution should fail with SQL State XJ001.  Instead client fails with a protocol
error and inserts wrong data. See the attached java program ReproReuseStream.java for a reproduction.
> [C:/kmarsden/repro/reusestream] java ReproReuseStream
> Insert row 1
> Try to insert row 2 with reused streams
> java.sql.SQLException: Network protocol error: end of stream prematurely reached, parameter
#4.  Remaining data has been
>  padded with 0x0.
>         at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:96)
>         at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
>         at org.apache.derby.client.am.PreparedStatement.executeUpdate(PreparedStatement.java:399)
>         at ReproReuseStream.main(ReproReuseStream.java:41)
> Caused by: org.apache.derby.client.am.SqlException: Network protocol error: end of stream
prematurely reached, parameter
>  #4.  Remaining data has been padded with 0x0.
>         at org.apache.derby.client.net.Request.writePlainScalarStream(Request.java:490)
>         at org.apache.derby.client.net.Request.writeScalarStream(Request.java:264)
>         at org.apache.derby.client.net.NetStatementRequest.buildEXTDTA(NetStatementRequest.java:951)
>         at org.apache.derby.client.net.NetStatementRequest.writeExecute(NetStatementRequest.java:147)
>         at org.apache.derby.client.net.NetPreparedStatement.writeExecute_(NetPreparedStatement.java:178)
>         at org.apache.derby.client.am.PreparedStatement.writeExecute(PreparedStatement.java:1801)
>         at org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:2031)
>         at org.apache.derby.client.am.PreparedStatement.executeUpdateX(PreparedStatement.java:404)
>         at org.apache.derby.client.am.PreparedStatement.executeUpdate(PreparedStatement.java:390)
>         ... 1 more
> Go ahead and commit so we can see the wrong data.
> ID         |MNAME
>                     |MVALUE     |BYTEDATA
>                                          |CHARDATA
> ------------------------------------------------------------------------------------------------------------------------
> ------------------------------------------------------------------------------------------------------------------------
> ------------------------------------------------------------------------------------------------------------------------
> --------------------------------------------------
> 1          |mname
>                     |0          |636363636363636363636363636363636363636363636363636363636363636363636363636363636363636
> 3636363636363636363636363636363636363636&|cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
> ccccccccccccccccccccccccccccccccccccccccccccccccc&
> 2          |mname
>                     |0          |000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 0000000000000000000000000000000000000000&|
>                                                  &
> To workaround the issue users should not attempt to reuse streams but we should give
a better message and not insert wrong data.
> The code was extracted from StreamingColumnTest testDerby500 but the commits were removed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message