tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Tomcat dies suddenly
Date Thu, 04 Feb 2010 22:32:35 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 2/3/2010 11:46 PM, Mark Eggers wrote:
> From the taroon-list: If you're running a 32 bit Linux and run out of
> low memory, it doesn't matter how much high memory you have, the OOM
> killer will start killing processes off. Since you're running a 64
> bit Linux, this should not be the problem.

I'm not sure what "low memory" space you're talking about. I don't
believe Linux segments memory in any particular way.

> A discussion on stackoverflow.com may be more relevant to your
> situation. It turns out (according to the discussion) that calling
> Runtime.getRuntime().exec() on a busy system can lead to transient
> memory shortages which trigger the OOM killer.

There is a kernel (ha) of truth to this: *NIX "exec" is implemented as
fork() and then exec(), with the former being a "clone this process"
call and the latter being a "replace this process with a new one" call.
The fork() then duplicates the currently-running process (the JVM) which
requires double the memory, and could cause OOM if you have a JVM memory
footprint that was close to the logical memory limit that the kernel has
imposed.

...except that Linux, specifically, and I would imagine *NIX in general,
implements copy-on-write behavior for fork()d processes. That means that
calling fork() on a running JVM doesn't eat up that much memory. This is
done intentionally because fork() is almost always followed by exec(),
where a duplicate of the old process in total would be a big waste of time.

Finally, the Linux OOM Killer is likely to choose the /new/ process to
murder, since it has been the shortest-running of the two (see
http://linux-mm.org/OOM_Killer). On the other hand, if the JVM is doing
a /lot/ of Runtime.exec() calls, it's "badness" might be calculated to
be quite high, and therefore the process dies.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktrSwMACgkQ9CaO5/Lv0PDZ9QCgwmqz82xDYE/PYPYt3eiRCJ6k
cFUAoK5yiUjvTQmICRbzdowihEuG1RWK
=L8sd
-----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