Commons Dbcp
  1. Commons Dbcp
  2. DBCP-318

PerUserPoolDataSource.getPooledConnectionAndInfo multi-threading bug

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      PerUserPoolDataSource.getPooledConnectionAndInfo(user,pass) has the code:

      Object pool = pools.get(key); // (1) pools = instance variable
      synchronized(this) {
          if (pool == null) {
              try {
                  registerPool(username, password);
                  pool = pools.get(key);
      [...]
      

      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.

        Activity

        Sebb created issue -
        Hide
        Sebb added a comment -

        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.

        Show
        Sebb added a comment - 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.
        Sebb made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        5m 39s 1 Sebb 05/Jan/10 20:07
        Resolved Resolved Closed Closed
        40d 5h 36m 1 Phil Steitz 15/Feb/10 01:43

          People

          • Assignee:
            Unassigned
            Reporter:
            Sebb
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development