You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "rod (JIRA)" <ji...@apache.org> on 2006/05/30 15:49:31 UTC

[jira] Created: (DBCP-189) [dbcp] Threads do not get a Connection in FIFO mode

[dbcp] Threads do not get a Connection in FIFO mode
---------------------------------------------------

         Key: DBCP-189
         URL: http://issues.apache.org/jira/browse/DBCP-189
     Project: Commons Dbcp
        Type: Bug

    Versions: 1.2 Final    
 Environment: commons-dbcp-1.2.1.jar
    Reporter: rod


hi,
the SharedPoolDataSource class uses the class GenericKeyedObjectPool which has a FIFO behavior.
the problem is that when all connections in the pool are used, the synchronised method SharedPoolDataSource.getPooledConnectionAndInfo 
calls the borrowObject() blocking method and does not release its monitor.
as a result, all other threads asking for a connection get blocked trying to get the monitor
and  will get a connection later in a non-FIFO mode.
i think the fix is to synchronized only the code block :
        if (pool == null) {
            try {
                registerPool(username, password);
            } catch (NamingException e) {
                throw new SQLNestedException("RegisterPool failed", e);
            }
        }
instead of synchronizing the whole method.

thanks
rodolphe

-- 
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


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


[jira] Updated: (DBCP-189) [dbcp] Threads do not get a Connection in FIFO mode

Posted by "Jerome Lacoste (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DBCP-189?page=all ]

Jerome Lacoste updated DBCP-189:
--------------------------------

    Attachment: DBCP-189.txt

Patch that implements the requested changes. Only unit tested. Didn't add a regression test.

> [dbcp] Threads do not get a Connection in FIFO mode
> ---------------------------------------------------
>
>          Key: DBCP-189
>          URL: http://issues.apache.org/jira/browse/DBCP-189
>      Project: Commons Dbcp
>         Type: Bug

>     Versions: 1.2 Final
>  Environment: commons-dbcp-1.2.1.jar
>     Reporter: rod
>  Attachments: DBCP-189.txt
>
> hi,
> the SharedPoolDataSource class uses the class GenericKeyedObjectPool which has a FIFO behavior.
> the problem is that when all connections in the pool are used, the synchronised method SharedPoolDataSource.getPooledConnectionAndInfo 
> calls the borrowObject() blocking method and does not release its monitor.
> as a result, all other threads asking for a connection get blocked trying to get the monitor
> and  will get a connection later in a non-FIFO mode.
> i think the fix is to synchronized only the code block :
>         if (pool == null) {
>             try {
>                 registerPool(username, password);
>             } catch (NamingException e) {
>                 throw new SQLNestedException("RegisterPool failed", e);
>             }
>         }
> instead of synchronizing the whole method.
> thanks
> rodolphe

-- 
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


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


[jira] Updated: (DBCP-189) [dbcp] Threads do not get a Connection in FIFO mode

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DBCP-189?page=all ]

Phil Steitz updated DBCP-189:
-----------------------------

    Version: 1.2.2
                 (was: 1.2 Final)

> [dbcp] Threads do not get a Connection in FIFO mode
> ---------------------------------------------------
>
>          Key: DBCP-189
>          URL: http://issues.apache.org/jira/browse/DBCP-189
>      Project: Commons Dbcp
>         Type: Bug

>     Versions: 1.2.2
>  Environment: commons-dbcp-1.2.1.jar
>     Reporter: rod
>  Attachments: DBCP-189.txt
>
> hi,
> the SharedPoolDataSource class uses the class GenericKeyedObjectPool which has a FIFO behavior.
> the problem is that when all connections in the pool are used, the synchronised method SharedPoolDataSource.getPooledConnectionAndInfo 
> calls the borrowObject() blocking method and does not release its monitor.
> as a result, all other threads asking for a connection get blocked trying to get the monitor
> and  will get a connection later in a non-FIFO mode.
> i think the fix is to synchronized only the code block :
>         if (pool == null) {
>             try {
>                 registerPool(username, password);
>             } catch (NamingException e) {
>                 throw new SQLNestedException("RegisterPool failed", e);
>             }
>         }
> instead of synchronizing the whole method.
> thanks
> rodolphe

-- 
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


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


[jira] Commented: (DBCP-189) [dbcp] Threads do not get a Connection in FIFO mode

Posted by "rod (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DBCP-189?page=comments#action_12414031 ] 

rod commented on DBCP-189:
--------------------------

however, getUserPassKey should be made synchronized cos the LRUMap is not Thread Safe.
rodolphe

> [dbcp] Threads do not get a Connection in FIFO mode
> ---------------------------------------------------
>
>          Key: DBCP-189
>          URL: http://issues.apache.org/jira/browse/DBCP-189
>      Project: Commons Dbcp
>         Type: Bug

>     Versions: 1.2 Final
>  Environment: commons-dbcp-1.2.1.jar
>     Reporter: rod

>
> hi,
> the SharedPoolDataSource class uses the class GenericKeyedObjectPool which has a FIFO behavior.
> the problem is that when all connections in the pool are used, the synchronised method SharedPoolDataSource.getPooledConnectionAndInfo 
> calls the borrowObject() blocking method and does not release its monitor.
> as a result, all other threads asking for a connection get blocked trying to get the monitor
> and  will get a connection later in a non-FIFO mode.
> i think the fix is to synchronized only the code block :
>         if (pool == null) {
>             try {
>                 registerPool(username, password);
>             } catch (NamingException e) {
>                 throw new SQLNestedException("RegisterPool failed", e);
>             }
>         }
> instead of synchronizing the whole method.
> thanks
> rodolphe

-- 
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


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


[jira] Resolved: (DBCP-189) [dbcp] Threads do not get a Connection in FIFO mode

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DBCP-189?page=all ]

Phil Steitz resolved DBCP-189.
------------------------------

    Resolution: Won't Fix

The dbcp API makes no commitments regarding preserving invariants of the underlying pool, other than that the exposed parameters work as advertised and the pool API is used to borrow and return objects.  In particular, the FIFO behavior of commons-pool is not guaranteed to be preserved by dbcp.
If there is more to this ticket than that (i.e., if there is a performance or concurrency problem here as well), please reopen.

> [dbcp] Threads do not get a Connection in FIFO mode
> ---------------------------------------------------
>
>                 Key: DBCP-189
>                 URL: http://issues.apache.org/jira/browse/DBCP-189
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: commons-dbcp-1.2.1.jar
>            Reporter: rod
>         Attachments: DBCP-189.txt
>
>
> hi,
> the SharedPoolDataSource class uses the class GenericKeyedObjectPool which has a FIFO behavior.
> the problem is that when all connections in the pool are used, the synchronised method SharedPoolDataSource.getPooledConnectionAndInfo 
> calls the borrowObject() blocking method and does not release its monitor.
> as a result, all other threads asking for a connection get blocked trying to get the monitor
> and  will get a connection later in a non-FIFO mode.
> i think the fix is to synchronized only the code block :
>         if (pool == null) {
>             try {
>                 registerPool(username, password);
>             } catch (NamingException e) {
>                 throw new SQLNestedException("RegisterPool failed", e);
>             }
>         }
> instead of synchronizing the whole method.
> thanks
> rodolphe

-- 
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

        

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