The user cache invalidator currently invariant's in its dtor. See
UserCacheInvalidator::~UserCacheInvalidator() {
invariant(globalInShutdownDeprecated());
// Wait to stop running.
wait();
}
The problem with this is that we make a UserCacheInvalidator in runMongosServer as part of mongos' startup. And then if anything goes wrong, before global shutdown, we crash in that invariant. That prevents us from returning an error code, letting an exception with a stack bubble up, etc.