You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2009/07/18 03:10:14 UTC

[jira] Created: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data

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.5.2.0, 10.6.0.0
            Reporter: Kathey Marsden


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.


[jira] Commented: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831255#action_12831255 ] 

Dag H. Wanvik commented on DERBY-4315:
--------------------------------------

I think it would be OK if Derby just throws an exception indicating EOF here, since we probably won't support using the same stream for two placeholders in a prepared statement either. 


> 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.0.0
>            Reporter: Kathey Marsden
>         Attachments: ReproReuseStream.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.


[jira] Updated: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-4315:
----------------------------------

    Attachment: ReproReuseStream.java

Attaching reproduction for this issue.  Run java ReproReuseStream

> 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.5.2.0, 10.6.0.0
>            Reporter: Kathey Marsden
>         Attachments: ReproReuseStream.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.


[jira] Commented: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910163#action_12910163 ] 

Kristian Waagan commented on DERBY-4315:
----------------------------------------

Note that from 10.6 (both client and server must be 10.6 or later) padded data won't be inserted into the database. This was fixed by DERBY-2017.

> 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: ReproReuseStream.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.


[jira] Updated: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-4315:
----------------------------------

    Affects Version/s: 10.1.3.1
                       10.2.2.0
                       10.3.3.0
                       10.4.2.0
                       10.5.1.1

verified back to 10.1


> 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.0.0
>            Reporter: Kathey Marsden
>         Attachments: ReproReuseStream.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.


[jira] Issue Comment Edited: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732813#action_12732813 ] 

Kathey Marsden edited comment on DERBY-4315 at 7/17/09 6:15 PM:
----------------------------------------------------------------

Attaching reproduction for this issue.  Start network server and run java ReproReuseStream

      was (Author: kmarsden):
    Attaching reproduction for this issue.  Run java ReproReuseStream
  
> 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.5.2.0, 10.6.0.0
>            Reporter: Kathey Marsden
>         Attachments: ReproReuseStream.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.