We’ve got a Java program that runs in Websphere, and uses an Oracle database using straight jdbc (no Hibernate or JPA). Our customer is doing load testing using HP Performance Center, and he’s getting occasional Oracle “deadlock” exceptions under load
Caused by: java.sql.SQLException: ORA-00060: deadlock detected while waiting for resource
Is there a way to, either in the code or externally, force the same sort of thread dump you get when you kill -3 the jvm when this exception happens?
Knowing how to enumerate threads won’t be of much use if you can’t detect automatically when the exception happens.
We do this all the time. We’re basically using:
when our app starts up and then we dump the infos we want when an exception occurs:
Map<Thread, StackTraceElement[]> mst = Thread.getAllStackTraces();Runtime.getRuntime().freeMemory()/maxMemory()/totalMemory()to get basic memory infosuser usage pattern if it’s an app the user can interact with
house-made “analytics”
etc.
You can then call a lot of other things and get fancy. For example we’re automatically sending crash reports (including the full stack trace) to a server waiting for such traces.