Flakiness and exceptions during tests (#12705)