You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@s-und-n.de> on 2002/03/26 14:52:34 UTC

[Bug?] Cocoon MRUStore not synchronized

Hi Team,

after investigating a little bit in some lockups I found out that
the MRUStore is not synchronized. Is this by intention?

It seems that under high load and with a little bit of luck all threads
hang in this loop in the hold() method:

while (this.mrulist.size() >= this.maxobjects) {
            /** ...ok, heapsize is reached, remove the last element... */
            this.free();
}

This is only an assumption. Anyone if this might be possible with let's say
100 concurrent threads?

Carsten

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


RE: [Bug?] Cocoon MRUStore not synchronized

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Gerhard Froehlich [mailto:g-froehlich@gmx.de]
> 
> Vadim,
> 
> >MRUStore synchronization is on my list. In current version I do not
> >expect issues except some exceptions, but I will change it to be
> >properly synchronized.
> 
> Hm, we could try the BucketMap from Excalibur Collection API instead
of
> a Hashtable. It's a highly optimized synchronized Hashmap and it's
used
> in the Excalibur ComponentManager.
> 
> What do you think?

I think among this lines also. But I'm going a bit further: I will kill
the LinkeList instance also, to increase performance and remove linear
list scans. Just need one free evening to finish this stuff, it is
almost done.

Vadim

> 
>   ~Gerhard
> 
> "Confucius say too much.
> (Recent Chinese Proverb)"
> 


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


RE: [Bug?] Cocoon MRUStore not synchronized

Posted by Gerhard Froehlich <g-...@gmx.de>.
Vadim,

>MRUStore synchronization is on my list. In current version I do not
>expect issues except some exceptions, but I will change it to be
>properly synchronized.

Hm, we could try the BucketMap from Excalibur Collection API instead of 
a Hashtable. It's a highly optimized synchronized Hashmap and it's used 
in the Excalibur ComponentManager.

What do you think?

  ~Gerhard
 
"Confucius say too much.
(Recent Chinese Proverb)"

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


Re: [Bug?] Cocoon MRUStore not synchronized

Posted by Peter Royal <pr...@managingpartners.com>.
On Tuesday 26 March 2002 09:54 am, Carsten Ziegeler wrote:
> We currently have the problem that Cocoon (or Tomcat) hangs after some
> period of activity. We tested this with several versions of
> tomcat, ranging from 3.2.4, 3.3, 3.3rc1 to 4.0.3) and jdks (1.3.1 sun,
> 1.3.1 blackdown, 1.4 sun) and windows/linux.

We are experiencing some hangs here, I haven't done anywhere near as much 
research as you though. Our production systems are all win2k, jdk1.3.1 and tc 
4.0.1.

I think ours are related to an exception happening during the SAX stream with 
incremental=true for xalan, I have just toggled that flag yesterday to see 
what happens.
-pete

-- 
peter royal -> proyal@managingpartners.com

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


RE: [Bug?] Cocoon MRUStore not synchronized

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Carsten Ziegeler wrote:
>
> Vadim Gritsenko wrote:
> >
> > MRUStore synchronization is on my list. In current version I do not
> > expect issues except some exceptions, but I will change it to be
> > properly synchronized.
> >
> Hmm, all hanging threads log the following lines from the hold()
> method:
>         if (getLogger().isDebugEnabled()) {
>             getLogger().debug("Holding object in memory:");
>             getLogger().debug("  key: " + key);
>             getLogger().debug("  value: " + value);
>         }
> And then nothing is logged. The next message in the log would
> be the release of the xml serializer but this never shows up,
> so I guess this is a synchronization problem in the MRUStore.
>
We currently have the problem that Cocoon (or Tomcat) hangs after some
period of activity. We tested this with several versions of
tomcat, ranging from 3.2.4, 3.3, 3.3rc1 to 4.0.3) and jdks (1.3.1 sun,
1.3.1 blackdown, 1.4 sun) and windows/linux.

All with the same result: tomcat does not respond at some time.
It seems that no OutOfMemory occurs.

When we put Cocoon to debug logging the last lines for each thread
are the above mentioned. And tomcat uses more and more threads as more
are comming in.

The stress test we currently do is to start each minute 27 requests
parallel.
Each request does some heavy operation which has a duration between 10 and
40
seconds!

I now synchronized all methods of the MRUStore and now all threads
inside Cocoon are processed (which means they left the service() method of
the servlet), but tomcat hangs and does not respond. Hm, so it seems we
have more than one problem here.

Anyone else experiencing problems like this?

Carsten


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


RE: [Bug?] Cocoon MRUStore not synchronized

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Vadim Gritsenko wrote:
> 
> MRUStore synchronization is on my list. In current version I do not
> expect issues except some exceptions, but I will change it to be
> properly synchronized.
> 
Hmm, all hanging threads log the following lines from the hold()
method:
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Holding object in memory:");
            getLogger().debug("  key: " + key);
            getLogger().debug("  value: " + value);
        }
And then nothing is logged. The next message in the log would
be the release of the xml serializer but this never shows up,
so I guess this is a synchronization problem in the MRUStore.

Carsten

> Vadim
> 
> > From: Carsten Ziegeler [mailto:cziegeler@s-und-n.de]
> > 
> > Hi Team,
> > 
> > after investigating a little bit in some lockups I found out that
> > the MRUStore is not synchronized. Is this by intention?
> > 
> > It seems that under high load and with a little bit of luck all
> threads
> > hang in this loop in the hold() method:
> > 
> > while (this.mrulist.size() >= this.maxobjects) {
> >             /** ...ok, heapsize is reached, remove the last element...
> */
> >             this.free();
> > }
> > 
> > This is only an assumption. Anyone if this might be possible with
> let's say
> > 100 concurrent threads?
> > 
> > Carsten
> 
> 
> ---------------------------------------------------------------------
> 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: [Bug?] Cocoon MRUStore not synchronized

Posted by Vadim Gritsenko <va...@verizon.net>.
MRUStore synchronization is on my list. In current version I do not
expect issues except some exceptions, but I will change it to be
properly synchronized.

Vadim

> From: Carsten Ziegeler [mailto:cziegeler@s-und-n.de]
> 
> Hi Team,
> 
> after investigating a little bit in some lockups I found out that
> the MRUStore is not synchronized. Is this by intention?
> 
> It seems that under high load and with a little bit of luck all
threads
> hang in this loop in the hold() method:
> 
> while (this.mrulist.size() >= this.maxobjects) {
>             /** ...ok, heapsize is reached, remove the last element...
*/
>             this.free();
> }
> 
> This is only an assumption. Anyone if this might be possible with
let's say
> 100 concurrent threads?
> 
> Carsten


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


RE: [Bug?] Cocoon MRUStore not synchronized

Posted by Berin Loritsch <bl...@apache.org>.
With a method like that, we have to ensure that it is called by
only one thread.  If the code snippet you have below is called
by every thread accessing the MRUStore, then it should be synchronized.
However, that will slow down the Cache to the point where it would
be cheaper to not have it.

It would be better to ensure that the method that contains that snippet
only be called by a controlling thread--where you can be assured that
there is only one thread, and that the snippet no longer needs
explicit synchronization.

Remember, uncontended synchronization is cheap--but contended
synchronization
is expensive.  Control code should be done asynchronously from the rest
of the system, and only by one thread.

> -----Original Message-----
> From: Carsten Ziegeler [mailto:cziegeler@s-und-n.de] 
> Sent: Tuesday, March 26, 2002 8:53 AM
> To: Cocoon-Dev
> Subject: [Bug?] Cocoon MRUStore not synchronized
> 
> 
> Hi Team,
> 
> after investigating a little bit in some lockups I found out 
> that the MRUStore is not synchronized. Is this by intention?
> 
> It seems that under high load and with a little bit of luck 
> all threads hang in this loop in the hold() method:
> 
> while (this.mrulist.size() >= this.maxobjects) {
>             /** ...ok, heapsize is reached, remove the last 
> element... */
>             this.free();
> }
> 
> This is only an assumption. Anyone if this might be possible 
> with let's say 100 concurrent threads?
> 
> Carsten
> 
> ---------------------------------------------------------------------
> 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