You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/08/03 00:27:05 UTC

[Bug 56805] New: datasource.getConnection() may be unnecessarily blocked by the PoolCleaner thread

https://issues.apache.org/bugzilla/show_bug.cgi?id=56805

            Bug ID: 56805
           Summary: datasource.getConnection() may be unnecessarily
                    blocked by the PoolCleaner thread
           Product: Tomcat Modules
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: jdbc-pool
          Assignee: dev@tomcat.apache.org
          Reporter: brenuart@gmail.com

The getConnection() method invokes borrowConnection(). The later polls the idle
collection for available existing connections. If a connection is available,
the method attempts to lock() it to gain exclusive access. It may happen the
connection is already locked by the PoolCleaner for validation for instance. In
this case, getConnection() will have to wait until the validation is completed
- even if other idle connections are available.

The attach test case illustrates the phenomenon. The pool starts with two
connections and uses a custom Validator waiting for 1000ms to simulate a slow
validation process. An attempt to get a connection from the pool is made when
the first connection is being validated by the PoolCleaner. At the end, the
test shows that the application gets the connection after 1000ms: it had to
wait for the completion of the validation although another connection was
immediately available in the idle pool.

The outcome becomes even worst if the validation never returns (because of a
missing validationQueryTimeout - see bug 56804): in this case, the application
thread is blocked forever as well.

Ideally, the borrow connection logic should somehow ignore connections under
validation and immediately consider the other connections available in the
pool.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 56805] datasource.getConnection() may be unnecessarily blocked by the PoolCleaner thread

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56805

Bertrand Renuart <br...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brenuart@gmail.com

--- Comment #1 from Bertrand Renuart <br...@gmail.com> ---
Created attachment 31867
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31867&action=edit
TestCase

-- 
You are receiving this mail because:
You are the assignee for the bug.

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