tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Notification strategy for OutOfMemoryError
Date Thu, 12 Dec 2013 03:07:35 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Bill,

On 12/11/13, 12:53 PM, Bill Davidson wrote:
> On 12/11/2013 7:14 AM, Christopher Schultz wrote:
>> 
>>>> 3. cath IOException in a filter and set an application 
>>>> attribute. Check this attribute from your monitor.
>>>> 
>>>> I've been considering doing this, because I can rig it so
>>>> that the error handler does not actually require any memory
>>>> to run. The problem is that sometimes OOMEs interrupt one
>>>> thread and not another. You may not catch the OOME in that
>>>> thread -- it may happen in a background thread that does not
>>>> go through the filter.
>>> I'm not sure I understand this one.  How does an IOException
>>> relate to an OOME?
>> Sorry, I meant of course OutOfMemoryError. Just make sure you use
>> as little memory as possible during the exception handler or it
>> will fail itself and possibly mask the original problem.
>> 
>> -
> 
> You can catch an OOME in a fiter?  I would not have expected that.

Sure, why not? You can catch anything that extends from Throwable[1].
Now, the handler might not actually succeed if it needs too much
memory to run, the JVM could actually call-over completely before the
catch block runs, etc. Basically, there are no guarantees: you can
only do your best.

- -chris

[1] Technically, the JVM allows you to throw and catch anything you
want to. The compiler is much more stringent. If you want to go
through the effort, you can use a Java "assembler" to build bytecode
directly, and the "throw" instruction will take any reference
argument. You can also set up a catch handler that will catch
non-Throwables. At least, you used to be able to do all this. It's
possible that modern .class verifiers will complain loudly if you try
to do silly things like this.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSqSh3AAoJEBzwKT+lPKRY0c4P/0yF73JykERsbycHMHDTeBd4
q2m8QkPe7Hlv+ZjddQXMA1TVQ0HU3uM6oJwrmdR5r51AQlRRMtHk5OD9N9ExV5GX
b8Oxtg6mzXKSdy5u/vOfw0VCwxwx79HnXi8yWmcbYG/6PaQCM0L91SzSvoy09jjP
jIh79iRbQjAnIg0z/WxOS2jlWvt9piO8irtEUVZ13J+K2wcloi+dMvCxrgA+fJnq
n7ELIJBGMVLMzo6/9WHdTas9xKaKfifLyrlgLCrWeFT5r7aFKSFjtk6xz2Jz+qsW
G3qW4ALBUuubxNxZZ82knmUnoUsrhi7BZEAoK8RcSdHHHZc9n54hWabk63iEFhQ8
Wow0kpwe3/XKTkR+zJrtOqeNO6dJYUI/jxf/3LIuiIBtbKx8GZpxRoI9Tl/dg8ds
/qrFbAHDTLmhgTqgQEs5y+fUczDH2oc+g6TWpjchH/MoJAoRCjg63dMRMrdee88w
ZCNT49yExsmQBgO9HGPmSUlU1HpRPJnvRFn54oRSbB7cDPOUhAnSADUQ7SUIm6G2
21KqZ4Y/5pP5zlIpekykOW3AGpvQKrZptMaDkUNm4s2BzH5w+B3+bQDb65jmFSL1
1Piy+QASDWXAOZC1UkYF9ltg/Se79qh8Kbar1mdfdp+u3HGGv9AoGztvjsX3FBc/
ddIIoVPPi9DohZdwocLj
=iO7b
-----END PGP SIGNATURE-----

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


Mime
View raw message