commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Thomson <mich...@canb.auug.org.au>
Subject Re: [POOL] Problem when blocking waiting to borrow from pool
Date Wed, 18 Oct 2006 20:38:06 GMT
Sandy,

Thanks again, it was method level synchronization causing the problem 
Doh.... I feel a real idiot.

Michael Thomson wrote:
> Sandy,
>
> I think you have spotted the "obvious" bug..... thank you.  I am an 
> idiot :-).  There is method level syncronization which is causing my 
> problem, I'm sure.  I will check and confirm to the list.
>
> I am using pool 1.3 implementation.
>
> Thank you all for your input.
>
> Michael.
>
> Sandy McArthur wrote:
>> Michael,
>>
>> What you are describing, if true, is a serious bug. My gut is that the
>> bug isn't with the GenericObjectPool code because I expect it would
>> have been reported by now.
>>
>> Without code that demonstrates the bug (aka:unit test) it's hard to
>> know anything for sure but the first thing that comes to mind is:
>>
>> GenericObjectPool is supposed to be thread-safe out of the box, if you
>> are adding any synchronization, such as calling pool.borrowObject from
>> with in your own synchronized block, then you could get the behavior
>> you describe. When a thread acquires a couple of locks by passing into
>> a synchronized block, calling Object.wait() only releases that one
>> lock and not all that have been acquired.  GenericObjectPool only
>> knows about it's internal locks and cannot release any of your code's
>> locks while it waits. This could create the inactivity you describe.
>>
>> Also, make sure you are using the latest Pool release (1.3) and if you
>> can generate a javacore (`kill -3 javapid` or ctrl+\ on unix, or
>> ctrl+break on windows) you should be able to see where the Threads are
>> waiting to acquire locks.
>>
>> Hope that helps some.
>>
>> On 10/18/06, Michael Thomson <michael@canb.auug.org.au> wrote:
>>> Hi,
>>>
>>> I have an app running in JBOSS
>>>
>>> I am trying to use the GenericObjectPool.
>>>
>>> I have two "user" objects and one "pool" object
>>>
>>> MaxActive =1
>>> pool.setWhenExhaustedAction(pool.WHEN_EXHAUSTED_BLOCK)
>>>
>>> It appears that when one "user" object is blocked waiting on a
>>> borrowObject() when the other "user" object attempts to returnObject(),
>>> both "user" objects "hang" until the maxWait time is reached?
>>>
>>> I can go into more detail if anyone thinks it will help.
>>>
>>> Anyone seen this problem, or have any suspicions, is JBoss likely to be
>>> interfering with anything here, anyone doing anything similar, it seems
>>> like a very basic use case?
>>>
>>> Thanks in Advance,
>>> Michael
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


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


Mime
View raw message