"Racing down the runway" by Philipp Lücke (cc-by-nc)

The case of the subtle race condition

Yesterday I got a strange race condition reported after I wrote some additional tests for pgzip. At first I couldn’t really work out why I was getting the race reported, and I suspected that the race detector was reporting wrong line numbers. The race reported was boiled down like this: