fix case where the same job re-acquires the exact same lock
add debugging code
4 files changed