I think the answer to the actual question is "No, there is nothing you can do."
But there's more to this. I've had stuff like this happen, and rather than "trying out various things" to see if the problem goes away, it's usually best to understand the underlying problem thoroughly.
To do this, copy to one side the current version of what you're running. Then do a split-the-difference sort of simplification.
The first step is to rip out half of the program and throw it away. Run what's left and see if you still get the problem.
If you do, then rip out half of what remains.
If the problem went away, take the original program and either rip out just a quarter of it, or find another way to rip it in half (some other code that comprises half of the source), and rerun it.
Keep going until you have the simplest possible program which reproduces the bug. It will be much easier to find the problem.
It sounds tedious. But:
- Simplifying the program until you understand the problem is likely to take maybe a week or two, rather than months (if not forever).
- Even if you did "try out various things" and found something that caused the symptom to go away, but you don't know exactly why, it's very likely that the underlying problem is still there, and is manifesting itself elsehow, including the possibility of outputting results that look reasonable but are wrong.
In your case, perhaps the best half to remove first is the half which, when removed, causes your execution time to drop dramatically, so you don't spend so much time waiting for a test to complete. (grin)
Hope this helps.