You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/01/05 21:01:54 UTC

[jira] Created: (DBCP-318) PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug

PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug
--------------------------------------------------------------------

                 Key: DBCP-318
                 URL: https://issues.apache.org/jira/browse/DBCP-318
             Project: Commons Dbcp
          Issue Type: Bug
            Reporter: Sebb


PerUserPoolDataSource.getPooledConnectionAndInfo(user,pass) has the code:
{code}
Object pool = pools.get(key); // (1) pools = instance variable
synchronized(this) {
    if (pool == null) {
        try {
            registerPool(username, password);
            pool = pools.get(key);
[...]
{code}

The first get() call can return null to multiple threads, so multiple threads can register the pool.
This allows more than maxActive() connections to be returned.


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


[jira] Closed: (DBCP-318) PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug

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

Phil Steitz closed DBCP-318.
----------------------------


> PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug
> --------------------------------------------------------------------
>
>                 Key: DBCP-318
>                 URL: https://issues.apache.org/jira/browse/DBCP-318
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>
> PerUserPoolDataSource.getPooledConnectionAndInfo(user,pass) has the code:
> {code}
> Object pool = pools.get(key); // (1) pools = instance variable
> synchronized(this) {
>     if (pool == null) {
>         try {
>             registerPool(username, password);
>             pool = pools.get(key);
> [...]
> {code}
> The first get() call can return null to multiple threads, so multiple threads can register the pool.
> This allows more than maxActive() connections to be returned.

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


[jira] Resolved: (DBCP-318) PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug

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

Sebb resolved DBCP-318.
-----------------------

    Resolution: Fixed

URL: http://svn.apache.org/viewvc?rev=896195&view=rev
Log:
DBCP-318 PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug

N.B. Also added a check in private method registerPool(String, String) to throw IllegalStateException if the key already existed in the pool.

> PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug
> --------------------------------------------------------------------
>
>                 Key: DBCP-318
>                 URL: https://issues.apache.org/jira/browse/DBCP-318
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>
> PerUserPoolDataSource.getPooledConnectionAndInfo(user,pass) has the code:
> {code}
> Object pool = pools.get(key); // (1) pools = instance variable
> synchronized(this) {
>     if (pool == null) {
>         try {
>             registerPool(username, password);
>             pool = pools.get(key);
> [...]
> {code}
> The first get() call can return null to multiple threads, so multiple threads can register the pool.
> This allows more than maxActive() connections to be returned.

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