Repeated 'Critical Stop' sounds

My code runs perfectly with no errors except for one minor problem: whilst it’s running, the critical stop sound plays over and over again.

I think I’ve managed to work out where in the my code the sound is being triggered and that by slowing the rate of updates I’d be able to reduce the rate that whatever underlying error is occurring at. But I’d really prefer to avoid having to reduce the rate of updates if at all possible. Is there some other solution to this sort of problem?

We’ll need more information in order to diagnose the problem. Can you reduce your code to a small testcase that we can run to reproduce the problem?