saltstack/salt — pull request #2172 by s0undt3ch (2012-10-05 05:33:22+00:00)
Title: Stop race condition of reading a file before written to. Refs #1935.

This issue started to appear at some random times. After some hours narrowing down the problem I came to the conclusion that, on some systems, specially under heavy load the file was being read before it was fully written to. This behaviour was visible on a local vagrant machine, and also on travis-ci which also uses vagrant, so, it might actually be an issue with the vagrant(VirtualBox) filesystem access. Anyway, using the atomic open we seem to completely avoid this issue. Not closing ticket just yet so we can keep checking if this is really gone.