If a mongod is shut down while it is still starting up (but after its config state is set to steady state), there are at least two races
1) The initial syncer may be created after we would have shut it down. This can be fixed by checking for _inShutdown in the critical section in _startDataReplication where we create the initial syncer; if it is set we should not create the initial syncer.
2) The data replication threads in ReplicationCoordinatorExternalStateImpl may be started after shutdown is called. This can be fixed by both setting _inShutdown to true even if _startedThreads is false in ReplicationCoordinatorExternalStateImpl::shutdown(), and also checking _inShutdown in ReplicationCoordinatorExternalStateImpl::startThreads.