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

Mayuresh Nirhali updated DERBY-2017:
------------------------------------

    Attachment: derby2017_try1.diff

This is a HIGH VALUE FIX CANDIDATE.

I did some more investigation to understand the exact difference in client 
behavior compared to the embedded.
In embedded mode, the stream is checked for its data by ReadertoUTF8Stream to 
see if the length specified is matching with the number of characters in the 
stream. An exception is raised if the length is not matched, hence we see the 
exception in the repro.

Client does not check for stream data before hand and reads the stream data 
only when that is needed to pass onto to the server. So, by the time the lenght 
matching errors are caught, the DSS header  and the full/partial data is sent 
to the server.

I tried a different approach (attached patch) to fix this bug. The stream is 
read (like in embedded mode) to validate the length much before the DSS header 
is sent to the server.

The patch is not  ready for commit, but it solves the problem. I feel, 
validation of stream should be done even before the place in attached patch, 
something like in LocatorStream which is under development. Like in embedded, a 
new method 'checkSufficientData' should be implemented in a class that is 
equivalent to ReaderToUTF8Stream in embedded.

I would like to see comments on this approach from experts.

> Client driver can insert and commit partial data when a LOB stream throws 
> IOException or does not match the specified length
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2017
>                 URL: https://issues.apache.org/jira/browse/DERBY-2017
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client
>    Affects Versions: 10.2.1.6
>            Reporter: Knut Anders Hatlen
>         Attachments: derby2017_try1.diff, Derby_2017_v1.diff, 
> Derby_2017_v1.stat, StreamErrRepro.java
>
>
> When a LOB stream throws an exception or does not match the specified length, 
> the client driver does not raise an exception until it has finished executing 
> the statement. Therefore, the statement will be executed (and possibly 
> committed) on the server even though the client reports that the statement 
> failed.

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

Reply via email to