A Hanging Build is a pain that we've all experienced more than once, and the most frustrating part about it is that you often can't detect the problem at an early stage, especially when you're taking advantage of the continuous integration process.
We've been running into the same problem. We have a huge number of builds being run every single second of the day, 24/7, and when even a few of them hang, it can be a big bottleneck. We like to think that common problems should be taken care of by our toolset, so naturally we've added a Hanging Build Detector to the latest version of TeamCity. It's been a real time-saver for us.
Having detected a possible hang, TeamCity reports it instantly, so you can review the details, even including the thread dump, on the web:
But you don't want to spend all of your precious time in the web client, so you can configure TeamCity to notify you in other ways about the probability of a hanging build:
Overall, you get to keep coding without worries about potential hanging builds. And that's the way we like it -- Especially when you've got to meet a tough timeframe.