I'm debugging an application running on Tomcat 7 that is proving to be extremely unstable. I see three of the four typical causes for site failure regularly: runaway CPU consumption, deadlocked threads and OutOfMemory conditions (about the only thing I don't see is DAO connection issues).
In the heapdump for crashes that happen due to OutOfMemory, I consistently see that a large portion of the heap (80%+) is taken up by a single object - an array of ints that is referenced (apparently) directly from org.apache.tomcat.util.threads.TaskThread. I've seen more than half billion elements in this array, causing it to take up gigabytes of heap space. When viewing the heap summary through YourKit, this object is listed as unreachable.
The application itself doesn't use int arrays to store anything, at least explicitly.
Any ideas where these may be coming from? I seem to remember reading that Expression Language elements can cause problems in newer versions of Tomcat but I can find little reference to this on Google. This intrigues me because when the servers die due to thread deadlocks, there are almost always thread blocked in the middle of EL evaluation. Could the EL engine be sharing space somehow and getting tangled up?