This doesn't seem ideal to me (it may hide/mask bugs in the future). I'd much prefer figuring out where the race is happening and add proper synchronization or simply change the code so that there isn't a concurrent modification happening.