[
https://issues.apache.org/jira/browse/POOL-149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12749846#action_12749846
]
Filippo Diotalevi commented on POOL-149:
----------------------------------------
Hi, I believe this problem is hitting me in pre-production, where all the
threads are dealocked at
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000010a2a1258> (a
org.apache.commons.pool.impl.GenericObjectPool)
at java.lang.Object.wait(Object.java:485)
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:942)
- locked <0x000000010a2a1258> (a
org.apache.commons.pool.impl.GenericObjectPool)
at
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(S
Can I have an update on this issue? Is there a patch I can apply to workaround
this problem?
> A serious concurrent bug can cause resource leak when Pool exhausted and
> borrowed objects are invalid
> -----------------------------------------------------------------------------------------------------
>
> Key: POOL-149
> URL: https://issues.apache.org/jira/browse/POOL-149
> Project: Commons Pool
> Issue Type: Bug
> Reporter: shuyang.zhou
> Priority: Critical
> Attachments: BugTest.java
>
>
> This bug will happen when the pool is in exhausted state and the borrowed
> object are invalid.
> Let's go through a simple scenario:
> 1)A GenericObjectPool with _maxActive==1,
> whenExhaustedAction==WHEN_EXHAUSTED_BLOCK
> 2)Two threads using that pool, called thread1 and thread2
> Here is error path:
> 1)thread1 calls pool.borrowObject() to get the object out of the pool
> //now the pool is exhausted
> 2)thread2 calls pool.borrowObject(), adds a new latch to the
> _allocationQueue, but before it enters the synchronized block for
> WHEN_EXHAUSTED_BLOCK(GenericObjectPool line 1099 revision 806215),
> context-switch happens
> 3)thread1 checks the object from pool, and decides to invalidate it. So it
> calls pool.invalidateObject(), which calls allocate(), then calls
> latch.notify(), but currently no thread is waiting on this latch.(thread2 has
> not enter the wait synchronized block yet).
> 4)Then thread2 will wait there for ever.(it just missed the notify)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.