You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leon Rosenberg <ro...@googlemail.com> on 2007/10/01 01:03:25 UTC

OOME crushing tomcat

Hi,

one of my customers recently increased amount of memory they use, so
OOME are happening more often. Most of them however do no harm, since
just the request is aborted, but the container remains functional and
next request wents well (they have a throughput of >100MB per second
in young generation so chances are good next request will get some
memory again).

However, this exception killed tomcat completely (no replies anymore):

Sep 30, 2007 6:56:51 PM
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
SEVERE: Caught exception (java.lang.OutOfMemoryError: Java heap space)
executing org.apache.tomcat.util.net.LeaderFollowerWorkerThread@41691942,
terminating thread

Any opinions, is that a bug in tomcat or is it inescapable after an OOME?

regards
Leon

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


[OT] RE: How to share tomcat sessions across multiple IE windows

Posted by Peter Crowther <Pe...@melandra.com>.
> From: Adam Lipscombe [mailto:adam.lipscombe@expensys.com] 
> My app spawns another window to display 
> help, via the window.open() javascript call.
> 
> The new window does not share the same session as the 
> original, the session ID is always different.
> Occasionally the ID of the new window is that of a session 
> that has expired so the user is 
> redirected to the login page.
[...]
> Does anyone know how to make the new window use the same 
> session as the original window?
> Or at least use a brand-new session rather than a recycled old one?

You can't.  This is a client-side problem.  As your first link says:
"Use a key in the querystring, tied to a cookie or a form, if session
state across windows is a necessity."

Alternatively... why does help display require the user to be logged in?
Can you bypass this by putting the help files somewhere that doesn't
require login?  Intuitively, they don't seem like data that requires
authentication to view...

		- Peter

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to share tomcat sessions across multiple IE windows

Posted by Adam Lipscombe <ad...@expensys.com>.
Sorry. My mistake

Mark Thomas wrote:
> When starting a new thread (ie sending a message to the list about a
> new topic) please do not reply to an existing message and change the
> subject line. This is known as thread hijacking and to many of the
> list archiving services and mail clients used by list subscribers this
> makes your new message appear as part of the old thread. This makes it
> harder for other users to find relevant information when searching the
> lists.
> 
> It should also be noted that many list subscribers automatically
> ignore any messages that hijack another thread.
> 
> The correct procedure is to create a new message with a new subject.
> This will start a new thread.
> 
> Thanks,
> 
> Mark
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 

________________________________
Adam Lipscombe
Escalus Software Systems
adam.lipscombe@expensys.com
Tel: 08450 170 850
www.expensys.com

This email and any files transmitted with it, including replies and
forwarded copies, may contain privileged and confidential information and
is intended solely for the person or organisation to whom it is addressed.
If you have received this communication in error, please notify us by email
(Notices@Escalus.net) or telephone (+44 (0)8450 170 850) and then delete the
email and any copies of it. Views or opinions expressed by an individual
within this email may not necessarily reflect the views of Escalus Software
Systems Ltd.

Although most emails and attachments from Escalus Software Systems Ltd are
screened, it is the responsibility of the recipient to ensure
that they are virus free. Escalus Software Systems Ltd will not accept any
liability for damage caused by a virus.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to share tomcat sessions across multiple IE windows

Posted by Mark Thomas <ma...@apache.org>.
When starting a new thread (ie sending a message to the list about a
new topic) please do not reply to an existing message and change the
subject line. This is known as thread hijacking and to many of the
list archiving services and mail clients used by list subscribers this
makes your new message appear as part of the old thread. This makes it
harder for other users to find relevant information when searching the
lists.

It should also be noted that many list subscribers automatically
ignore any messages that hijack another thread.

The correct procedure is to create a new message with a new subject.
This will start a new thread.

Thanks,

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to share tomcat sessions across multiple IE windows

Posted by Adam Gordon <ad...@readytalk.com>.
Hmmm, we have a webapp that requires authentication to launch a specific
function and we spawn multiple windows with window.open() and we don't
have any problem with the browser session IDs being changed.  Are you
switching from http to https or vice versa?  This would certainly result
in different session ID's being created.  Additionally, if you're
somehow invalidating the primary window's session before spawning the
new window, then it would also get a new session ID.

Hope that helps.

--adam

-----Original Message-----
From: Adam Lipscombe [mailto:adam.lipscombe@expensys.com] 
Sent: Wednesday, October 10, 2007 2:54 AM
To: Tomcat Users List
Subject: How to share tomcat sessions across multiple IE windows

Folks,


Apologies, this is not strictly a tomcat question but I wonder if anyone
else has run into it and 
has a solution.  My app spawns another window to display help, via the
window.open() javascript call.

The new window does not share the same session as the original, the
session ID is always different.
Occasionally the ID of the new window is that of a session that has
expired so the user is 
redirected to the login page.


I think his behaviour is IE specific, I found a couple of (non tomcat)
explanations here:

http://classicasp.aspfaq.com/general/how-do-i-manage-a-session-across-mu
ltiple-windows.html.

http://de3.php.net/session-start

In the latter it says:
"The problem is that IE doesn't always use the same IE process to host a
new pop-up window - it 
chooses one (using some mysterious strategy) from the pool of running IE
processes! Since session 
information (cookies) is not preserved across processes, the pop-up may
loose the session (and 
probably redirect the user to your log-in page.)"




Does anyone know how to make the new window use the same session as the
original window?
Or at least use a brand-new session rather than a recycled old one?




TIA - Adam







---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


How to share tomcat sessions across multiple IE windows

Posted by Adam Lipscombe <ad...@expensys.com>.
Folks,


Apologies, this is not strictly a tomcat question but I wonder if anyone else has run into it and 
has a solution.  My app spawns another window to display help, via the window.open() javascript call.

The new window does not share the same session as the original, the session ID is always different.
Occasionally the ID of the new window is that of a session that has expired so the user is 
redirected to the login page.


I think his behaviour is IE specific, I found a couple of (non tomcat) explanations here:

http://classicasp.aspfaq.com/general/how-do-i-manage-a-session-across-multiple-windows.html.

http://de3.php.net/session-start

In the latter it says:
"The problem is that IE doesn't always use the same IE process to host a new pop-up window - it 
chooses one (using some mysterious strategy) from the pool of running IE processes! Since session 
information (cookies) is not preserved across processes, the pop-up may loose the session (and 
probably redirect the user to your log-in page.)"




Does anyone know how to make the new window use the same session as the original window?
Or at least use a brand-new session rather than a recycled old one?




TIA - Adam







---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: OOME crushing tomcat

Posted by Mark Thomas <ma...@apache.org>.
Leon Rosenberg wrote:
> Any opinions, is that a bug in tomcat or is it inescapable after an OOME?

OOME will kill Tomcat. I have seen it struggle on after an OOME but it
always dies shortly afterwards.

You need to get a profiler (I use YourKit) and find out what is using
all the memory. Then: fix the leak if there is one; report a bug in
Tomcat it it has a memory leak (fairly unlikely these days); add ram
to the machine; or reduce the load on the machine.

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: OOME crushing tomcat

Posted by Mark Thomas <ma...@apache.org>.
William Leung wrote:
> I had face the same problem, OOME sometimes "kill" tomcat connector.
> 
> I setup two connectors (HTTP and AJP), while one connector was "dead", the
> other still "alive", and I could access manager/status from the "live" one
> to watch the "dead" one's status.
> 
> I think it is tomcat's bug

Almost certainly not. Chances are it is an application bug. A profiler
will tell you for sure.

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: OOME crushing tomcat

Posted by William Leung <lw...@21cn.com>.
I had face the same problem, OOME sometimes "kill" tomcat connector.

I setup two connectors (HTTP and AJP), while one connector was "dead", the
other still "alive", and I could access manager/status from the "live" one
to watch the "dead" one's status.

I think it is tomcat's bug


Leon Rosenberg-3 wrote:
> 
> Hi,
> 
> one of my customers recently increased amount of memory they use, so
> OOME are happening more often. Most of them however do no harm, since
> just the request is aborted, but the container remains functional and
> next request wents well (they have a throughput of >100MB per second
> in young generation so chances are good next request will get some
> memory again).
> 
> However, this exception killed tomcat completely (no replies anymore):
> 
> Sep 30, 2007 6:56:51 PM
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
> SEVERE: Caught exception (java.lang.OutOfMemoryError: Java heap space)
> executing org.apache.tomcat.util.net.LeaderFollowerWorkerThread@41691942,
> terminating thread
> 
> Any opinions, is that a bug in tomcat or is it inescapable after an OOME?
> 
> regards
> Leon
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/OOME-crushing-tomcat-tf4545506.html#a13120810
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: OOME crushing tomcat

Posted by Rainer Jung <ra...@kippdata.de>.
The nature of OOMEs is, that they can happen in every part of the code, 
that needs a new peace of memory. No one is able to write code in a way, 
that can handle memory allocation failures in all places new memory is 
needed.

If you run into an OOME, it is very unwise to let the JVM run along, 
even if it looks OK (only this request got aborted etc.). If the JVM 
needs memory, it tries to free memory. If you get an OOME, it's not 
unlikely, that not only object couldn't get allocated and also it's 
likely, that the OOME will happen again. The failed allocations could be 
in your webapp, in your 3rd party libraries, in the container, in the 
3rd party libs of the container etc.

After an OOME, the behaviour of the whole stack is UNDEFINED. You can't 
even be sure, that the data you deliver is correct!

That's why an OOME usually means you have to restart the JVM. There's no 
stable way to detect, how big the damage is. If you let the JVM run, you 
are taking a huge risk.

All those are true for general Java processes, including Tomcat. There 
are no application controlled allocation pools in Java, such that a 
container can shield itself from the deployed app eating all the memory.

One special case is OOME in Tomcat thread pool. If your load increases 
and Tomcat needs more threads, it could happen that during 
initialization of this thread memory allocation fails and the new thread 
- supposed to take over the network listen fails to get into live and 
you loose your listen on the socket. In this case Tomcat indeed looks 
dead, because the request accepting mechanism got hit by the OOME. In 
this case Tomcat is the victim, not the culprit.

I think there's no sense in making this thread allocation more robust 
(at least as long as we are talking about OOME coming from heap), 
because then the OOME will simply hit some other place with a more 
subtle impact. By my above statements, the immediate impact is not 
relevant, because you can't really control which components are affected 
and need to restart anyways.

Regards,

Rainer

Leon Rosenberg wrote:
> Hi,
> 
> one of my customers recently increased amount of memory they use, so
> OOME are happening more often. Most of them however do no harm, since
> just the request is aborted, but the container remains functional and
> next request wents well (they have a throughput of >100MB per second
> in young generation so chances are good next request will get some
> memory again).
> 
> However, this exception killed tomcat completely (no replies anymore):
> 
> Sep 30, 2007 6:56:51 PM
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
> SEVERE: Caught exception (java.lang.OutOfMemoryError: Java heap space)
> executing org.apache.tomcat.util.net.LeaderFollowerWorkerThread@41691942,
> terminating thread
> 
> Any opinions, is that a bug in tomcat or is it inescapable after an OOME?
> 
> regards
> Leon
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org