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.

{
    CHMAC_SHA256 computeHash((const uint8_t*)key.data(), key.size());
    std::vector<uint8_t> computedHash(CHMAC_SHA256::OUTPUT_SIZE, 0);
    computeHash.Write(cookie.data(), cookie.size());
    computeHash.Write(clientNonce.data(), clientNonce.size());
    computeHash.Write(serverNonce.data(), serverNonce.size());
    computeHash.Finalize(computedHash.data());
    return computedHash;
}
void TorController::authchallenge_cb(TorControlConnection& _conn, const TorControlReply& reply)
{
    if (reply.code == 250) {
        LogPrint(BCLog::TOR, "tor: SAFECOOKIE authentication challenge successful\n");
        std::pair<std::string,std::string> l = SplitTorReplyLine(reply.lines[0]);
        if (l.first == "AUTHCHALLENGE") {
            std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
            if (m.empty()) {
                LogPrintf("tor: Error parsing AUTHCHALLENGE parameters: %s\n", SanitizeString(l.second));
                return;
            }
            std::vector<uint8_t> serverHash = ParseHex(m["SERVERHASH"]);
            std::vector<uint8_t> serverNonce = ParseHex(m["SERVERNONCE"]);
            LogPrint(BCLog::TOR, "tor: AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
            if (serverNonce.size() != 32) {
                LogPrintf("tor: ServerNonce is not 32 bytes, as required by spec\n");