[FIXED JENKINS-5076]

Verified that JENKINS-5076 is no longer happening.

Looking at the code, I think the actual fix was in a2d825769669dd8be68feeb80f7886728bd87eb9.