2009/8/28 Bradley Wagner <bradley.wag...@hannonhill.com>

> I have a Spring/Hibernate app running in Tomcat 5.5.20 that we've tested in
> many environments that is currently faltering when running in a Ubuntu 7
> VM.
> Basically on startup, frequently, the startup process will halt when trying
> to read Hibernate's HBM files and in various other places in startup
> process. When it stops both CPUs are pegged at 200% usage by the java
> process (from 'top'). At this point, the only recourse is to kill the app
> with "kill -9 <pid>". Occasionally the app will start all the way up. Then,
> I can trigger a re-index of the content in the app's database using Lucene
> and the app will freeze again.
>
> The only thing I've been able to find in common about these operations is
> that they seem to be heavy I/O.


One trick would be to take a thread dump when the app locks up.  kill -3
<pid> will trigger such a dump.  The output will be in one of Tomcat's
logfiles (catalina.out by default, I think).  That might allow you to get
debugging information, as you're getting the data without having to enable
JPDA.

Sometimes it's useful to take several thread dumps, a few seconds apart, and
analyse them.  However, given your suspicions of a race condition, I'm not
sure that's appropriate in this case as perturbing the system during startup
might prevent the race condition.

A few notable environment variables
> - JAVA_OPTS="-Xmx512M -XX:MaxPermSize=128m -Djava.awt.headless=true
> -Dfile.encoding=UTF-8"
> - running Sun's Java 1.5.0.16
> - running Ubuntu 4.2.3-2ubuntu7 (from "cat /proc/version")


Thanks!  Far too few posters provide this information without prompting.

Are you stuck on Java 1.5?  1.6 is generally faster, though you may prefer
to stay with a version that you've tested with your app.


> Strangely, I tried to debug the application by enabling JPDA:
> JAVA_OPTS="-Xmx512M -XX:MaxPermSize=128m -Xdebug
> -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
> -Djava.awt.headless=true -Dfile.encoding=UTF-8"
> and the application starts up flawlessly. In fact, when running with JPDA
> enabled, it's impossible to get it to freeze even when doing the content
> re-index.


Chuck would know better, but I wonder whether enabling JPDA disables some
optimisations in the JVM and/or the compiler.

Any debugging next steps or ideas are appreciated.
>
> Should I look at:
> - different ubuntu versions
> - different Java versions
> - different Tomcat versions


My first step would be to see whether a thread dump gives you any useful
information.  I'd suggest at least going to the latest 5.5 release anyway
(5.5.28), as there have been some security fixes since 5.5.20 came out.  You
might wish to try the latest major version (6.0.20) and see how well it
behaves; it depends how much testing you want/need to do!


> Is the fact that it works with JPDA indicative of some kind of race
> condition possibly?
>

See above - I suspect JPDA changes several things inside the JVM, but I'm
far from being the Java guru on this list.

- Peter

Reply via email to