Fixed a deadlock created in insert_into_alljobs_by_rank.
TRQ-2473