Sunday, October 14, 2007

ThreadDumps and StackTraces

Thread Dumps and Stack Traces are useful tools for debugging java applications. In JBossAS there are several ways to get stacktraces, most common being to use the jmx-console. An entry point to the various techiques for taking thread dumps is this wiki page.

Browsing the Java Specialists archive, I found yet another JSP-based threaddump utility. The difference with the thread dump you get with the jmx-console is that a sorted summary of the threads is presented in the beginning of the page, with links to the individual stacktraces that follow in the bottom of the page. The jmx-console in contrast shows the stacktraces inline with the list of threads, grouped according to their groupId and sorted by their threadId.

I adapted this for JBossAS and you can find it here.

5 comments:

william.louth said...

Hi,

Have you check out this following blog entry showing how it is even possible to include runtime state when not limited by a web UI to display complex data.

JXInsight 4.2.3 - Threads and Artifact Changes
http://blog.jinspired.com/?p=19

By the way the real operation approach is to acquire diagnostics images of the various call frames.

Introducing JXInsight 5.0 Diagnostics
http://blog.jinspired.com/?p=34

All other Diagnostics related entries.
http://blog.jinspired.com/?cat=19

regards,

William Louth
JXInsight Product Architect
JINSPIRED

Dimitris Andreadis said...

Will have a look, thanks.

andyhot said...

Hi,
It must be a coincidence, but I recently went ahead and augmented Tapestry's stack trace reporting by adding 2 things (perhaps they deserve a blog entry, but i'm quickly listing them here - could be helpful)

-) Highlight user packages. If there's ANY way to know which packages are user code, go ahead and use that information - it makes a huge difference.

-) Collapse / Hide similar subsequent traces or traces from generated code (you have to know a regexp for those): reduces size, hides the noise

Anyway, I 'almost' have this packaged in a small & cute js function, so ... it could be instantly usable I guess

Andreas Andreou - andyhot.gr

Dimitris Andreadis said...

Andy, the wiki page contains a link to the .war file. Can you make your addition there and send it to me to try? Thanks.

william.louth said...

I just wanted to add that in our implementation of Diagnostics we can list arguments, the target class (different than the execution code class), and report on object field (graph) state for all related objects including a complete class meta-model that includes code sources and classloader information. This can all be exported and viewed off-line with easy navigation, class classifications (icon), and annotation support.

Probably over kill for most jboss developers but very important in an operational context.

But I suppose getting something out is more important at this stage.

regards,

William