You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/05/18 11:36:06 UTC

[Bug 61103] New: StatementCache potentially returning incorrect statement

https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

            Bug ID: 61103
           Summary: StatementCache potentially returning incorrect
                    statement
           Product: Tomcat Modules
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: jdbc-pool
          Assignee: dev@tomcat.apache.org
          Reporter: julian.reschke@gmx.de
  Target Milestone: ---

See <https://issues.apache.org/jira/browse/OAK-6237>.

It seems that StatementCache under certain circumstances returns an incorrect
statement, causing setString on index 1 to fail with:

com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10145][10844][4.16.53]
Invalid parameter 1: Parameter index is out of range. ERRORCODE=-4461,
SQLSTATE=42815

Note:

- currently cleanly reproducible with jackrabbit oak trunk (and release
branches)
- happens only for DB2 it seems
- disabling the StatementCache interceptor fixes the problem
- Oak currently uses 7.0.75, but the same problem happens with 7.0.77

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61103] StatementCache potentially caching non-functional PreparedStatement with DB2

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

Julian Reschke <ju...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|StatementCache potentially  |StatementCache potentially
                   |returning incorrect         |caching non-functional
                   |statement                   |PreparedStatement with DB2

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [Bug 61103] StatementCache potentially returning incorrect statement

Posted by Julian Reschke <ju...@gmx.de>.
On 2017-09-21 16:04, bugzilla@apache.org wrote:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=61103
> 
> --- Comment #2 from Julian Reschke <ju...@gmx.de> ---
> Still present in 7.0.81.

Hi there.

Is there anything I can do to get a Tomcat JDBC expert to look into this?

FWIW, this issue is 100% reproducible; it just needs a checkout of 
Apache Jackrabbit Oak, and a local DB2 instance.

Best regards, Julian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61103] StatementCache potentially returning incorrect statement

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

--- Comment #2 from Julian Reschke <ju...@gmx.de> ---
Still present in 7.0.81.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61103] StatementCache potentially returning incorrect statement

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

--- Comment #4 from Julian Reschke <ju...@gmx.de> ---
Found in
<https://blog.bertvanlangen.com/software-development/jdbc-statement-cache/>:

"The IBM Data Server Driver for JDBC and SQLJ does not check whether the
definitions of target objects of statements in the internal statement cache
have changed. If you execute SQL data definition language statements in an
application, you need to disable internal statement caching for that
application"

So caching PreparedStatements for DB2 is dangerous if it's a DDL statement, or
if actually the state of the table changes between invocations (such as a
transition from "does not exist" to "exist").

Now code can of course workaround this, but wouldn't it be better if the
StatementCache would evict statements that have causes a non transient
exception?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61103] StatementCache potentially returning incorrect statement

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

--- Comment #1 from Julian Reschke <ju...@gmx.de> ---
and it happens with 8.5.15 as well...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61103] StatementCache potentially returning incorrect statement

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

Julian Reschke <ju...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://issues.apache.org/j
                   |                            |ira/browse/OAK-6237

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61103] StatementCache potentially returning incorrect statement

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

--- Comment #3 from Julian Reschke <ju...@gmx.de> ---
It seems I found the issue: s statement was indeed re-used, but on the first
invocation the table wasn't present; with DB2, that state apparently is stored
with the statement object. Will close this ticket once I fixed my code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61103] StatementCache potentially returning incorrect statement

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61103

Julian Reschke <ju...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
                 CC|                            |kfujino@apache.org

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org