Thanks dp. The build timeout plugin is almost what we want, but not quite. It would be really nice if it could be applied to individual build steps only.
Our Jenkins job consists of a build step to compile the project, and another build step to run some tests on it. The compilation step can take anywhere between one minute and two hours (depending on what needs to be built). It's very reliable and so doesn't need a timeout. The test step should take a few minutes, but sometimes gets hung up. We would like to have a timeout on that step only. The build timeout plugin doesn't allow a timeout to be set on an individual step. So, we'd need to set a timeout for the whole project of the order of three hours to allow for the longest compilation time. But that would mean that, if the compilation only takes a few minutes and the tests hang up, we'd waste three hours before we found out. I suppose I could split the project into two and have the test project depened on the compilation project and then set a timeout on the latter only.
Would the build timeout plugn do what you want? http://wiki.hudson-ci.org/display/HUDSON/Build-timeout+Plugin