[ http://issues.apache.org/jira/browse/DERBY-1002?page=all ]

Deepa Remesh updated DERBY-1002:
--------------------------------

           type: Bug  (was: Improvement)
    Fix Version: 10.2.0.0
      Assign To: Deepa Remesh
       Priority: Major  (was: Trivial)

I had checked and thought the reset/re-initialization of DRDAStatement and 
DRDAResultSet states is happening correctly in the network server code. Hence I 
had marked this issue to be an improvement. I found I was wrong. Sorry about 
that.

Things I had not understood correctly:

1) DRDAStatement.rsClose() has this check: if (currentDrdaRs.getResultSet() == 
null) return;
I had thought the condition will evaluate to true only when DRDAResultSet is 
constructed or after DRDAResultSet.close() has been called. So the 
DRDAResultSet would have been already reset whenever this condition is true. 
This is not correct.

2) Fields like DRDAResultSet.qryclsimp get set only in OPNQRY path. However, 
writeQRYDTA method used for OPNQRY and EXCSQLSTT are same. Hence, in EXCSQLSTT 
path, it is possible for the query to use a left-over qryclsimp. Because of 1) 
above, if hasdata value is also not reset and is false, server will close a 
query wrongly (even when the query should not be closed implicitly and actually 
has more data). One possible error case is - A client  which expects a QRYDTA 
as reply to CNTQRY may get a QRYNOPRM from the server.

In short, this part of network server code is not correct and is causing bugs 
which are easy to repro with my patch for DERBY-210 but also occur with the 
current trunk. This issue blocks DERBY-210.

I have a repro for a bug against the trunk which I will upload shortly with 
some more context.

> Check that DRDAStatement and DRDAResultSet states are reset when they are 
> re-used
> ---------------------------------------------------------------------------------
>
>          Key: DERBY-1002
>          URL: http://issues.apache.org/jira/browse/DERBY-1002
>      Project: Derby
>         Type: Bug
>   Components: Network Server
>     Reporter: Deepa Remesh
>     Assignee: Deepa Remesh
>      Fix For: 10.2.0.0

>
> Network server re-uses DRDAStatement and DRDAResultSet objects when client 
> sends a request with same section number. When re-using DRDAStatement, it's 
> close() method is called which inturn calls close() method of DRDAResultSet. 
> For re-use to work properly, we have to ensure the states of these objects 
> are reset. This is not a bug but it is an area for possible improvements like:
> * The reset of all states are not in the close() methods. The states get 
> re-initialized at different places in the code. Fo example, in case of 
> DRDAResultSet, they get initialized in some other DRDAStatement methods - 
> like addResultSet, setRsDefaultOptions, setOPNQRYOptions, setQueryOptions 
> etc. It will be good to have all resets in one method.
> * The method name "close" is confusing since it is also called when objects 
> get re-used. For clarity, it may be good to have a method named reset(). And 
> then have the close method call reset.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to