tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <>
Subject RE: [partially off topic] How can I detect java.lang.OutOfMemoryError
Date Wed, 16 Apr 2003 06:48:42 GMT
As you have a quite undefined state after a OutOfMemoryError
occured you can't rely on anything that tries to do anything
inside the current vm.

I see following options:

- Monitor the application or the the log from the outside
  for OutOfMemoryErrors.

- Monitor the application from the inside, but don't watch 
  for OutOfMemoryErrors but for the total/free memory
  and do what you want whenever these value reach critical

- Do a mixture of both (My recommendation):
  Write a jsp that prints out the total and free memory
  Write a external job that requests this page frequently,
  and performs the check on the result. (This way you can
  decrease the treshhold for the  critical values, as you
  don't have to rely on the current vm to send the mail)

> -----Original Message-----
> From: Reynir Hübner []
> Sent: Tuesday, April 15, 2003 5:49 PM
> To: Tomcat Users List
> Subject: [partially off topic] How can I detect
> java.lang.OutOfMemoryError
> Hi, 
> I am trying to find a good way to detect and handle 
> java.lang.OutOfMemoryError. 
> There are obvious problems to this, if this error occures the 
> VM is basically "crashed" but not dead, it cannot allocate 
> more memory. 
> I would like to handle such errors by sending an email to the 
> system administrator and restarting the service running 
> tomcat, and maybe even add few megabytes to the Xmx JVM parameter. 
> Just for the record, I know what causes the OutOfMemoryError, 
> and it's not really an error or anything, it's just pure 
> load, and of course it's always possible to adjust some 
> things around the server, for example shorten the session 
> timeouts, so sessions data would be garbage-collected faster.
> As I said the server is under a lot of continuous load, and 
> this error happens when someone does something very 
> memory-demanding, for example I've seen it happen when using 
> the reload function in the manager application.
> So, now I'm wondering what is the best way of detecting the error ?
> I'm using windows 2000 servers...
> Thanx
> -reynir
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message