Finding and solving a race condition in WordPress: a tale of two threads