<p>I've been running Tomcat 5.5 with Java 1.4 for a while now with a huge webapp.  Most of the time it runs fine, but sometimes it will just hang, with no exception generated, and no apparant way of getting it to run again other than re-starting Tomcat.  The tomcat instance is allowed a gigabyte of memory on the heap, but rarely exceeds 300 MB.  Has anyone else run into this issue, and is there a solution for it?</p>

<p>For clarification: I determined how much memory it is using via Task Manager and via Eclipse (I've also tried running it outside of Eclipse, but get the same problem eventually, though it takes a little longer).  With Eclipse, I look at the memory allocated via its little (optional) memory pane and the amount allocated to javaw.exe via the task manager.  I use the sysdeo? tomcat plugin for Eclipse.</p>

[{'answer_id': 66163, 'author': 'Herms', 'author_id': 1409, 'author_profile': 'https://Stackoverflow.com/users/1409', 'pm_score': 0, 'selected': False, 'text': "<p>It sounds like you're hitting a deadlock.</p>\n\n<p>If you can reproduce it in a dev environment then try attaching a debugger once it's happened.  Take a look at your threads and see if you have any deadlocks.</p>\n\n<p>If you can't get a debugger to attach you should be able to generate a thread dump, as Dustin pointed out.</p>\n"}, {'answer_id': 66168, 'author': 'DustinB', 'author_id': 7888, 'author_profile': 'https://Stackoverflow.com/users/7888', 'pm_score': 3, 'selected': True, 'text': '<p>For any jvm process, force a thread dump. In windows, this can be done with CTRL-BREAK, I believe, in the console window.</p>\n\n<p>In *nix, it is almost always "kill -3 jvm-pid".</p>\n\n<p>This may show if you have threads waiting on db connection pool/thread pool, etc.</p>\n\n<p>Another thing to check out is how many connections you have currently to the JVM -- either use NETSTAT or SysInternals utility such as tcpconn/tcpview (google it).</p>\n\n<p>Also, try to run with the verbose:gc JVM flag.  For Sun\'s JVM, run like "java -verbose:gc".  This will show your garbage collections.  If it is collecting a lot (FULL COLLECTIONS, expecially) then you probably have a memory leak.  The full collections are costly, especially on large heaps like that.</p>\n\n<p>How are you determining that only 300mb are being used?</p>\n'}, {'answer_id': 66175, 'author': 'zxcv', 'author_id': 9628, 'author_profile': 'https://Stackoverflow.com/users/9628', 'pm_score': 0, 'selected': False, 'text': '<p>Try increasing the logging sensitivity for the Tomcat application server.\n<a href="http://tomcat.apache.org/tomcat-5.5-doc/logging.html" rel="nofollow noreferrer">http://tomcat.apache.org/tomcat-5.5-doc/logging.html</a></p>\n\n<p>You can increase the sensitivity to FINEST or ALL for most of them for a few days and see if that helps you catch anything. </p>\n'}, {'answer_id': 66275, 'author': 'Kevin', 'author_id': 8530, 'author_profile': 'https://Stackoverflow.com/users/8530', 'pm_score': 0, 'selected': False, 'text': '<p>I agree with creating multiple thread dumps and viewing them though this: <a href="http://today.java.net/pub/n/TDA1.1" rel="nofollow noreferrer">Thread Dump Analyzer</a></p>\n'}]
['https://Stackoverflow.com/questions/66104', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8026/']