Automatic Java Deadlock Detection

No Comments

Deadlocks are a nasty thing for programmers. They usually occur never in development environments, but only in production. Also, because it is affecting production, operation teams resolve those issues quickly by restarting the server, destroying all evidence for developers.

So developers almost never have a chance to see a deadlock in action.

Wouldn’t it cool to have such information on hand? Something looking like this:

But good news! I did not make this picture up. It is part of AppDynamics, which will automatically detect deadlocks in production environments and provide all the information needed to fix them.

For the following quick demo screencast I used the “Dining Philosophers” problem, described in an alternative variant by Dr. Heinz Kabutz in his recent newsletter. Heinz told me of this recently, when he taught his Java Specialists Master Course at codecentric in D├╝sseldorf. I had planned to do a demo of the deadlock detection feature, but did not have time to write a nice deadlock yet. Thanks Heinz ­čÖé

When AppDynamics has an agent in a live JVM, it will monitor thread activity and check for deadlocks automatically. This works without any configuration and with the usual very low overhead AppDynamics takes.

Because it preserves the information for developers, it is safe to restart the machine. The information what caused the deadlock will be still available for debugging. This has proven quite useful during our Java Performance troubleshooting gigs.

I think the deadlock detection is a very useful feature, which is not very obvious in AppDynamics, because it has no button to activate. Of course that’s good, because it works fully automatic.


Your email address will not be published. Required fields are marked *