You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Vadim Gritsenko <vg...@hns.com> on 2001/06/11 15:20:52 UTC

[OT: Avalon][Patch] Deadlock in Excalibur's DefaultPool

Hello,

In my effort to eliminate resource leackage in ContentAggregator,
I found that Excalibur's DefaultPool is deadlock-prone.
Deadlock situation occur when component which is being returned
to pool is also want to return component of the same type
(effectively, to the same pool).

I do not have Avalon CVS on hand, so here is description of the change 
instead of a patch.

To fix the problem, part of the put() method which now read:
------------------------------------------------------------
        try
        {
            super.m_mutex.lock();
            if(obj instanceof Recyclable)
                ((Recyclable)obj).recycle();
            super.m_active.remove(super.m_active.indexOf(obj));
            getLogger().debug("Returning a " + super.m_factory.getCreatedClass().getName() + " to the pool");
------------------------------------------------------------
Should be:
------------------------------------------------------------
        try
        {
            if(obj instanceof Recyclable)
                ((Recyclable)obj).recycle();
            super.m_mutex.lock();
            super.m_active.remove(super.m_active.indexOf(obj));
            getLogger().debug("Returning a " + super.m_factory.getCreatedClass().getName() + " to the pool");
------------------------------------------------------------

I think that Berin or any other active Avalon developer should be able
to fix this.

PS: This should go actually to Avalon list, but I'm not subscribed...

Thanks,
Vadim

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


Re: [OT: Avalon][Patch] Deadlock in Excalibur's DefaultPool

Posted by Berin Loritsch <bl...@apache.org>.
Vadim Gritsenko wrote:
> 
> Hello,
> 
> In my effort to eliminate resource leackage in ContentAggregator,
> I found that Excalibur's DefaultPool is deadlock-prone.
> Deadlock situation occur when component which is being returned
> to pool is also want to return component of the same type
> (effectively, to the same pool).

Thanks, I will apply it.
> 
> I do not have Avalon CVS on hand, so here is description of the change
> instead of a patch.
> 
> To fix the problem, part of the put() method which now read:
> ------------------------------------------------------------
>         try
>         {
>             super.m_mutex.lock();
>             if(obj instanceof Recyclable)
>                 ((Recyclable)obj).recycle();
>             super.m_active.remove(super.m_active.indexOf(obj));
>             getLogger().debug("Returning a " + super.m_factory.getCreatedClass().getName() + " to the pool");
> ------------------------------------------------------------
> Should be:
> ------------------------------------------------------------
>         try
>         {
>             if(obj instanceof Recyclable)
>                 ((Recyclable)obj).recycle();
>             super.m_mutex.lock();
>             super.m_active.remove(super.m_active.indexOf(obj));
>             getLogger().debug("Returning a " + super.m_factory.getCreatedClass().getName() + " to the pool");
> ------------------------------------------------------------
> 
> I think that Berin or any other active Avalon developer should be able
> to fix this.
> 
> PS: This should go actually to Avalon list, but I'm not subscribed...
> 
> Thanks,
> Vadim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

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


Re: [OT: Avalon][Patch] Deadlock in Excalibur's DefaultPool

Posted by Berin Loritsch <bl...@apache.org>.
Vadim Gritsenko wrote:
> 
> Hello,
> 
> In my effort to eliminate resource leackage in ContentAggregator,
> I found that Excalibur's DefaultPool is deadlock-prone.
> Deadlock situation occur when component which is being returned
> to pool is also want to return component of the same type
> (effectively, to the same pool).
> 
> I do not have Avalon CVS on hand, so here is description of the change
> instead of a patch.

Avalon CVS is fixed.  When Avalon 4.0beta4 is released, we will see it
in Cocoon CVS.

> 
> To fix the problem, part of the put() method which now read:
> ------------------------------------------------------------
>         try
>         {
>             super.m_mutex.lock();
>             if(obj instanceof Recyclable)
>                 ((Recyclable)obj).recycle();
>             super.m_active.remove(super.m_active.indexOf(obj));
>             getLogger().debug("Returning a " + super.m_factory.getCreatedClass().getName() + " to the pool");
> ------------------------------------------------------------
> Should be:
> ------------------------------------------------------------
>         try
>         {
>             if(obj instanceof Recyclable)
>                 ((Recyclable)obj).recycle();
>             super.m_mutex.lock();
>             super.m_active.remove(super.m_active.indexOf(obj));
>             getLogger().debug("Returning a " + super.m_factory.getCreatedClass().getName() + " to the pool");
> ------------------------------------------------------------
> 
> I think that Berin or any other active Avalon developer should be able
> to fix this.
> 
> PS: This should go actually to Avalon list, but I'm not subscribed...
> 
> Thanks,
> Vadim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

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