Make trace-interruption logic more robust when sighandlers hang.

Resolves #784.