[Utils][test] Fix a problem that may cause a deadlock when the test fails.