You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "David Wolverton (JIRA)" <ji...@apache.org> on 2010/06/23 19:00:51 UTC

[jira] Created: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

In JDBCStoreManager . connect method, should check if connection is closed
--------------------------------------------------------------------------

                 Key: OPENJPA-1706
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.0.0, 1.2.2
         Environment: We were using 1.2.2, but I see the same problem code in trunk.
            Reporter: David Wolverton
            Priority: Minor


The code currently reads:
// connect if the connection is currently null, or if
// the connection has been closed out from under us
if (_conn == null)
    _conn = connectInternal();

The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:

if (_conn == null || _conn.isClosed())
    _conn = connectInternal();

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


[jira] Assigned: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis reassigned OPENJPA-1706:
------------------------------------

    Assignee: Rick Curtis

> In JDBCStoreManager . connect method, should check if connection is closed
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1706
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2, 2.0.0
>         Environment: We were using 1.2.2, but I see the same problem code in trunk.
>            Reporter: David Wolverton
>            Assignee: Rick Curtis
>            Priority: Minor
>
> The code currently reads:
> // connect if the connection is currently null, or if
> // the connection has been closed out from under us
> if (_conn == null)
>     _conn = connectInternal();
> The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:
> if (_conn == null || _conn.isClosed())
>     _conn = connectInternal();

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


[jira] Commented: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

Posted by "David Wolverton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890349#action_12890349 ] 

David Wolverton commented on OPENJPA-1706:
------------------------------------------

@Rick -- That is correct.

> In JDBCStoreManager . connect method, should check if connection is closed
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1706
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2, 2.0.0
>         Environment: We were using 1.2.2, but I see the same problem code in trunk.
>            Reporter: David Wolverton
>            Assignee: Rick Curtis
>            Priority: Minor
>         Attachments: OPENJPA-1706.patch
>
>
> The code currently reads:
> // connect if the connection is currently null, or if
> // the connection has been closed out from under us
> if (_conn == null)
>     _conn = connectInternal();
> The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:
> if (_conn == null || _conn.isClosed())
>     _conn = connectInternal();

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


[jira] Updated: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis updated OPENJPA-1706:
---------------------------------

    Attachment: OPENJPA-1706.patch

Attaching a patch with the suggested code change and a unit test.

To force the reported condition I closed the underlying connection without the JDBCStoreManager being aware that it was closed.

> In JDBCStoreManager . connect method, should check if connection is closed
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1706
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2, 2.0.0
>         Environment: We were using 1.2.2, but I see the same problem code in trunk.
>            Reporter: David Wolverton
>            Assignee: Rick Curtis
>            Priority: Minor
>         Attachments: OPENJPA-1706.patch
>
>
> The code currently reads:
> // connect if the connection is currently null, or if
> // the connection has been closed out from under us
> if (_conn == null)
>     _conn = connectInternal();
> The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:
> if (_conn == null || _conn.isClosed())
>     _conn = connectInternal();

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


[jira] Commented: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

Posted by "David Wolverton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889544#action_12889544 ] 

David Wolverton commented on OPENJPA-1706:
------------------------------------------

In response to Rick's first comment:

IWe had a larger problem that a Spring managed transaction was bound to the thread and never closed so requests to our webapp kept using the same transaction. Eventually the underlying connection for the transaction closed but and an error was thrown when when JPA was still trying to use that closed conneciton.

In our case patching the JPA code here was a cure for the one symptom but until we tracked down the root cause of the transaction leak, we still had other issues.

> In JDBCStoreManager . connect method, should check if connection is closed
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1706
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2, 2.0.0
>         Environment: We were using 1.2.2, but I see the same problem code in trunk.
>            Reporter: David Wolverton
>            Assignee: Rick Curtis
>            Priority: Minor
>         Attachments: OPENJPA-1706.patch
>
>
> The code currently reads:
> // connect if the connection is currently null, or if
> // the connection has been closed out from under us
> if (_conn == null)
>     _conn = connectInternal();
> The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:
> if (_conn == null || _conn.isClosed())
>     _conn = connectInternal();

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


[jira] Closed: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis closed OPENJPA-1706.
--------------------------------

    Resolution: Not A Problem

I'm closing this issue because I don't think this is a problem. Connections shouldn't just close on their own and the proposed code change would mask a spontaneous connection closure.

Please feel free to reopen this issue if you disagree and would like to discuss further.



> In JDBCStoreManager . connect method, should check if connection is closed
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1706
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2, 2.0.0
>         Environment: We were using 1.2.2, but I see the same problem code in trunk.
>            Reporter: David Wolverton
>            Assignee: Rick Curtis
>            Priority: Minor
>         Attachments: OPENJPA-1706.patch
>
>
> The code currently reads:
> // connect if the connection is currently null, or if
> // the connection has been closed out from under us
> if (_conn == null)
>     _conn = connectInternal();
> The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:
> if (_conn == null || _conn.isClosed())
>     _conn = connectInternal();

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


[jira] Commented: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890290#action_12890290 ] 

Rick Curtis commented on OPENJPA-1706:
--------------------------------------

@David -- So once you fixed the Spring managed tran problem this code change wasn't necessary?

> In JDBCStoreManager . connect method, should check if connection is closed
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1706
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2, 2.0.0
>         Environment: We were using 1.2.2, but I see the same problem code in trunk.
>            Reporter: David Wolverton
>            Assignee: Rick Curtis
>            Priority: Minor
>         Attachments: OPENJPA-1706.patch
>
>
> The code currently reads:
> // connect if the connection is currently null, or if
> // the connection has been closed out from under us
> if (_conn == null)
>     _conn = connectInternal();
> The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:
> if (_conn == null || _conn.isClosed())
>     _conn = connectInternal();

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


[jira] Commented: (OPENJPA-1706) In JDBCStoreManager . connect method, should check if connection is closed

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888550#action_12888550 ] 

Rick Curtis commented on OPENJPA-1706:
--------------------------------------

Can you please post some more information on how this is happening in your environment? What happened to the underlying connection? 

I'm afraid that merely creating a new connection in this instance may cause some unforeseen problems (Then again, maybe I'm just being paranoid.) ?

> In JDBCStoreManager . connect method, should check if connection is closed
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1706
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1706
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2, 2.0.0
>         Environment: We were using 1.2.2, but I see the same problem code in trunk.
>            Reporter: David Wolverton
>            Assignee: Rick Curtis
>            Priority: Minor
>         Attachments: OPENJPA-1706.patch
>
>
> The code currently reads:
> // connect if the connection is currently null, or if
> // the connection has been closed out from under us
> if (_conn == null)
>     _conn = connectInternal();
> The comment indicates that it should check for null or closed, but the code only checks for closed. Our application got to the state where connection was actually closed but not null. We patched this with the following code to make it work:
> if (_conn == null || _conn.isClosed())
>     _conn = connectInternal();

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