Possible race condition and consequent crash