You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/04/18 21:11:00 UTC

[jira] [Commented] (OPENJPA-2789) JDBC connection not closed when running named query in explicitly opened connection

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

ASF subversion and git services commented on OPENJPA-2789:
----------------------------------------------------------

Commit eb2dbec1273e52d4258ed2b183106ca8d098ed94 in openjpa's branch refs/heads/master from Mark Struberg
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=eb2dbec ]

OPENJPA-2789 close connection after bulk delete

while ResultSetResult closes the underlying connection we did loose this handling in
JDBCStoreQuery when XROP sharding got added.


> JDBC connection not closed when running named query in explicitly opened connection
> -----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2789
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2789
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.4.3
>         Environment: Windows 7, Java 8 64 Bit, openJPA 2.4.3, maven 3.6.1
>            Reporter: Wolfgang Rupprath
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 3.1.3
>
>         Attachments: jpa243bug.zip
>
>
> When executing a named query against a database within an explicitly opened transaction, after 10 successful executions the program hangs.
> The problem occured when we started migrating from openJPA 2.2.0 to 2.4.3
> I have tested against DB2 and Oracle databases with the same results. I suspect the problem arises for any relational DB.
> I have attached a simple maven project that will demonstrate the bug.
> Under 2.2.0, the test runs fine.
> When the query is changed to a native query, the test runs fine.
> Debugging the openJPA code, I found suspicious code in class org.apache.openjpa.jdbc.kernel.JDBCStoreQuery, method executeBulkOperation, line 587:
>             try {
>  {{         if (conn.getAutoCommit())}}
>                         conn.close(); 
>   {{        } catch (SQLException se) {}}{{}}}{{}}
> The connection in case will not be returned to the pool as the conn.close() is not executed wthin a transaction. So when committing, the ref count will not be zero when the transaction ends and the underlying JDBC connection will not be closed.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)