My system suffers from OOM (presumably due to a DOS attack). I'm using Tomcat 7, NIO. I'm looking for ways to make my system more robust to these attacks (although I don't expect to make Tomcat completely immune - I want to improve robustness as much as possible).
My logs show:
Exception in thread "http-nio-8080-exec-285" Exception in thread "http-nio-8080-exec-82" SEVERE:Memory usage is low, parachute is non existent, your system may start failing.
Exception in thread "PoolCleaner[216942577:1400676008859]" SEVERE:Memory usage is low, parachute is non existent, your system may start failing.
So I started investigating the oomParachute.
The documentation (http://tomcat.apache.org/tomcat-7.0-doc/config/http.html) says very little:
(int)The NIO connector implements an OutOfMemoryError strategy called parachute. It holds a chunk of data as a byte array. In case of an OOM, this chunk of data is released and the error is reported. This will give the VM enough room to clean up. The oomParachute represents the size in bytes of the parachute(the byte array). The default value is 1024*1024(1MB). Please note, this only works for OOM errors regarding the Java Heap space, and there is absolutely no guarantee that you will be able to recover at all. If you have an OOM outside of the Java Heap, then this parachute trick will not help.
So I'm trying to figure out:
Is there really a default like the doc says? If so, why am I getting "parachute is non existent" ?
Should I define a parachute? What value should I put there? What parameters play a role in determining the value of this parameter? (number of concurrent connections? expected size of request? total heap?)
What does this parachute really do?
Thanks!
As the docs says, this Parachute is simply a byte[]
allocated so that in the event of an OutOfMemory
error it can be freed so the action of reporting said OutOfMemory
can be executed. Since the system is already out of available memory, it seems unlikely that you'll recover from the problem.
That error message is hard-coded at the NioEndpoint class: http://grepcode.com/file/repository.springsource.com/org.apache.coyote/com.springsource.org.apache.coyote/6.0.24/org/apache/tomcat/util/net/NioEndpoint.java#NioEndpoint.0oomParachuteData (scroll down just a bit and you'll see it, right below the oomParachute - it is periodically set at checkParachute(), line 694 and at line 1331 you can see how it is used, and some developer humor)
Probably meaning "hey, I just used the parachute, you're on your own now!" hehe.
As for setting it to a reasonable value, it largely depends on how much RAM you have available, how much RAM your system usually uses, how much RAM it normally uses during peak times and some other factors. Having said that, this "parachute" isn't supposed to save you, just soften up the OutOfMemory error a bit so it can be logged and all that.
I personally recommend JavaMelody for tracking your memory usage and have an overall "what's going on" with your server. It can show you memory usage, CPU usage, all the threads running and what are they doing, SQLs you ran and much more: https://github.com/javamelody/javamelody/wiki - It's really easy to install and use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With