Merged fix for trq-1690 from the 4.1-dev branch. (deadlock remove_job/find_job_by_array).