This avoids a deadlock on resource failure when retry==0. Without this we would never exit. This adds a test in too!