Your problem is likely not related to benchmark. You are using the thread, not the benchmark.
It’s also likely not IO related. For one it’ll usually crash. This particular printing also won’t run unless you have an error so it won’t affect working code.
You most likely have another race condition or but in your code. The benchmark code simply runs the code many more times than you usually do that exposes the bug.