detect deadlock (issue #36)