The test courier has a racy map access, and this started to manifest after some recent changes. This patch fixes the race by implementing the corresponding locks.