This was tested by running the test in a tight loop, previously it consistently failed within a minute on my machine, with this change it successfully runs for several minutes in a tight loop without failing.
Fixes: #1607