Using Ubuntu 18.04.2 LTS, with up-to-date, self-compiled master.
When I run
`./bitcoind -regtest -whitebind=bla`
I expect a clean shutdown with `Error: Cannot resolve -whitebind address: 'bla'`.
However sometimes my node doesn't stop and freezes (shutdown never finishes). 
This happens ~30% of the time for me, both on testnet and regtest. 

I believe that this is because `torControlThread.join();` never returns if it the thread is stopped right after its creation - it is started right before the whitebind part in `AppInitMain()`. If I insert a sleep before whitebind parameters are processed in Step 12 of `AppInitMain()` (or if I just disable the TorControl thread) the error does not occur.

Could someone try to reproduce? I encountered this testing #16248, but it is not restricted to this branch.

} else if (methods.count("NULL")) {
            LogPrint(BCLog::TOR, "tor: Using NULL authentication\n");
            _conn.Command("AUTHENTICATE", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
        } else if (methods.count("SAFECOOKIE")) {
            
            LogPrint(BCLog::TOR, "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
            std::pair<bool,std::string> status_cookie = ReadBinaryFile(cookiefile, TOR_COOKIE_SIZE);
            if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) {
                
                cookie = std::vector<uint8_t>(status_cookie.second.begin(), status_cookie.second.end());
                clientNonce = std::vector<uint8_t>(TOR_NONCE_SIZE, 0);
                GetRandBytes(clientNonce.data(), TOR_NONCE_SIZE);
                _conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), std::bind(&TorController::authchallenge_cb, this, std::placeholders::_1, std::placeholders::_2));
            } else {
                if (status_cookie.first) {
                    LogPrintf("tor: Authentication cookie %s is not exactly %i bytes, as is required by the spec\n", cookiefile, TOR_COOKIE_SIZE);
                } else {
                    LogPrintf("tor: Authentication cookie %s could not be opened (check permissions)\n", cookiefile);
                }
            }
        } else if (methods.count("HASHEDPASSWORD")) {
            LogPrintf("tor: The only supported authentication mechanism left is password, but no password provided with -torpassword\n");
        } else {
            LogPrintf("tor: No supported authentication method\n");
        }
    } else {
        LogPrintf("tor: Requesting protocol info failed\n");
    }
}
void TorController::connected_cb(TorControlConnection& _conn)