valgrind (with --tool=helgrind) is reporting a bunch of data races in our code. Some of them are sloppy initialization or cleanup, some regular run-time races. Clean 'em up.