[ 
https://issues.apache.org/jira/browse/DBCP-415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13967995#comment-13967995
 ] 

Sebb commented on DBCP-415:
---------------------------

I'm seeing a different problem (I think).

DelegatingPreparedStatement.executeQuery() calls getDelegate(). It looks like 
sometimes this returns a statement created in a different thread. This looks to 
be because it is using a PoolablePreparedStatement 
This extends DelegatingPreparedStatement which extends DelegatingStatement 
which is not thread-safe; in particular the _closed flag is not volatile. 
However _stmt is also not synch, nor is _conn.
Ideally those two should be made final. Although there is a setDelegate() 
method it does not appear to be used.

Setting all three volatile seems to reduce the number of failures, but does not 
solve the problem completely.

> Pooled PreparedStatements may be closed when accessed
> -----------------------------------------------------
>
>                 Key: DBCP-415
>                 URL: https://issues.apache.org/jira/browse/DBCP-415
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Phil Steitz
>
> Under high concurrency, connections using pooled PreparedStatements may 
> encounter SQLExceptions with messages of the form 
> "org.apache.commons.dbcp2.PoolablePreparedStatement with address: 'quoted 
> SQL' is closed."



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to