From 0e0ba2fd866e6f6f3b89008dbe7d3a8e0c826ff5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 22 Aug 2020 00:37:23 +0300 Subject: SL-13830 One more coroutine crash --- indra/newview/llvoicevivox.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoicevivox.cpp') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 42a1cf95a7..970570b135 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -411,6 +411,7 @@ void LLVivoxVoiceClient::terminate() } else { + mRelogRequested = false; killGateway(); } } @@ -660,12 +661,18 @@ void LLVivoxVoiceClient::voiceControlCoro() U32 retry = 0; - while (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) + while (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE && !LLApp::isExiting()) { LL_DEBUGS("Voice") << "Suspending voiceControlCoro() momentarily for teleport. Tuning: " << mTuningMode << ". Relog: " << mRelogRequested << LL_ENDL; llcoro::suspendUntilTimeout(1.0); } + if (LLApp::isExiting()) + { + mIsCoroutineActive = false; + return; + } + do { bool success = startAndConnectSession(); -- cgit v1.2.3 From a42045994dacbf687cb986d8f1a644f0399cffb5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 28 Aug 2020 01:22:35 +0300 Subject: SL-13555 'Second Life quit unexpectedly' error message --- indra/newview/llvoicevivox.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoicevivox.cpp') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 970570b135..7b6d9613ac 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -1740,6 +1740,12 @@ bool LLVivoxVoiceClient::waitForChannel() mIsProcessingChannels = true; llcoro::suspend(); + if (LLApp::isExiting()) + { + mRelogRequested = false; + break; + } + if (mTuningMode) { performMicTuning(); @@ -1784,6 +1790,13 @@ bool LLVivoxVoiceClient::waitForChannel() { llcoro::suspendUntilTimeout(1.0); } + + if (LLApp::isExiting()) + { + mRelogRequested = false; + break; + } + } while (mVoiceEnabled && !mRelogRequested); LL_DEBUGS("Voice") @@ -1813,7 +1826,7 @@ bool LLVivoxVoiceClient::waitForChannel() << " RelogRequested=" << mRelogRequested << " VoiceEnabled=" << mVoiceEnabled << LL_ENDL; - return true; + return !LLApp::isExiting(); } bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) -- cgit v1.2.3 From 3ab3d957de295fb755440c534aa5aa4d65852fc8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 1 Sep 2020 21:24:06 +0300 Subject: SL-13830 Don't crash if quiting during startup --- indra/newview/llvoicevivox.cpp | 44 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvoicevivox.cpp') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 7b6d9613ac..746ed69417 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -919,10 +919,12 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() //--------------------------------------------------------------------- llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS); + bool quiting = LLAppViewer::isExiting(); + LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL; LLVoiceVivoxStats::getInstance()->reset(); - while (!mConnected) + while (!mConnected && !quiting) { LLVoiceVivoxStats::getInstance()->connectionAttemptStart(); LL_DEBUGS("Voice") << "Attempting to connect to vivox daemon: " << mDaemonHost << LL_ENDL; @@ -937,10 +939,16 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() if (!mConnected) { llcoro::suspendUntilTimeout(DAEMON_CONNECT_THROTTLE_SECONDS); + quiting = LLAppViewer::isExiting(); } } //--------------------------------------------------------------------- + if (quiting && !mConnected) + { + return false; + } + llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS); while (!mPump) @@ -977,11 +985,13 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() { LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL; - while (!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) + bool quiting = LLApp::isExiting(); + while ((!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) && !quiting) { LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL; // *TODO* Pump a message for wake up. llcoro::suspend(); + quiting = LLApp::isExiting(); } std::string url = gAgent.getRegionCapability("ProvisionVoiceAccountRequest"); @@ -1001,6 +1011,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() { LLVoiceVivoxStats::getInstance()->provisionAttemptStart(); result = httpAdapter->postAndSuspend(httpRequest, url, LLSD(), httpOpts); + quiting = LLApp::isExiting(); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1010,6 +1021,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() F32 timeout = pow(PROVISION_RETRY_TIMEOUT, static_cast(retryCount)); LL_WARNS("Voice") << "Provision CAP 404. Retrying in " << timeout << " seconds." << LL_ENDL; llcoro::suspendUntilTimeout(timeout); + quiting = LLApp::isExiting(); } else if (!status) { @@ -1021,10 +1033,15 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() { provisioned = true; } - } while (!provisioned && retryCount <= PROVISION_RETRY_MAX); + } while (!provisioned && retryCount <= PROVISION_RETRY_MAX && !quiting); + + if (quiting && !provisioned) + { + return false; + } LLVoiceVivoxStats::getInstance()->provisionAttemptEnd(provisioned); - if (! provisioned ) + if (!provisioned) { LL_WARNS("Voice") << "Could not access voice provision cap after " << retryCount << " attempts." << LL_ENDL; return false; @@ -1069,6 +1086,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection() LLSD result; bool connected(false); bool giving_up(false); + bool quiting = LLApp::isExiting(); int retries = 0; LL_INFOS("Voice") << "Requesting connection to voice service" << LL_ENDL; @@ -1077,6 +1095,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection() do { result = llcoro::suspendUntilEventOn(mVivoxPump); + quiting = LLApp::isExiting(); LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL; if (result.has("connector")) @@ -1085,12 +1104,13 @@ bool LLVivoxVoiceClient::establishVoiceConnection() connected = LLSD::Boolean(result["connector"]); if (!connected) { - if (result.has("retry") && ++retries <= CONNECT_RETRY_MAX) + if (result.has("retry") && ++retries <= CONNECT_RETRY_MAX && !quiting) { F32 timeout = LLSD::Real(result["retry"]); timeout *= retries; LL_INFOS("Voice") << "Retry connection to voice service in " << timeout << " seconds" << LL_ENDL; llcoro::suspendUntilTimeout(timeout); + quiting = LLApp::isExiting(); if (mVoiceEnabled) // user may have switched it off { @@ -1113,7 +1133,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection() LL_DEBUGS("Voice") << (connected ? "" : "not ") << "connected, " << (giving_up ? "" : "not ") << "giving up" << LL_ENDL; - } while (!connected && !giving_up); + } while (!connected && !giving_up && !quiting); if (giving_up) { @@ -1183,6 +1203,7 @@ bool LLVivoxVoiceClient::loginToVivox() bool response_ok(false); bool account_login(false); bool send_login(true); + bool quiting = LLApp::isExiting(); do { @@ -1194,13 +1215,14 @@ bool LLVivoxVoiceClient::loginToVivox() } LLSD result = llcoro::suspendUntilEventOnWithTimeout(mVivoxPump, LOGIN_ATTEMPT_TIMEOUT, timeoutResult); + quiting = LLApp::isExiting(); LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL; if (result.has("login")) { std::string loginresp = result["login"]; - if ((loginresp == "retry") || (loginresp == "timeout")) + if (((loginresp == "retry") || (loginresp == "timeout")) && !quiting) { LL_WARNS("Voice") << "login failed with status '" << loginresp << "' " << " count " << loginRetryCount << "/" << LOGIN_RETRY_MAX @@ -1228,6 +1250,7 @@ bool LLVivoxVoiceClient::loginToVivox() LL_WARNS("Voice") << "login " << loginresp << " will retry login in " << timeout << " seconds." << LL_ENDL; llcoro::suspendUntilTimeout(timeout); + quiting = LLApp::isExiting(); } else if (loginresp == "failed") { @@ -1242,9 +1265,14 @@ bool LLVivoxVoiceClient::loginToVivox() { account_login = true; } + else if (quiting) + { + mIsLoggingIn = false; + return false; + } } - } while (!response_ok || !account_login); + } while ((!response_ok || !account_login) && !quiting); mRelogRequested = false; mIsLoggedIn = true; -- cgit v1.2.3 From 74f23cde48829577d330ec0624135b45564af0ac Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 11 Sep 2020 21:34:13 +0300 Subject: SL-13830 Remade vivox shutdown to terminate when it is told to shutdown instead of when viewer is quiting --- indra/newview/llvoicevivox.cpp | 69 ++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'indra/newview/llvoicevivox.cpp') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 746ed69417..976ef61d8e 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -274,6 +274,8 @@ static void killGateway() /////////////////////////////////////////////////////////////////////////////////////////////// +bool LLVivoxVoiceClient::sShuttingDown = false; + LLVivoxVoiceClient::LLVivoxVoiceClient() : mSessionTerminateRequested(false), mRelogRequested(false), @@ -381,6 +383,7 @@ LLVivoxVoiceClient::~LLVivoxVoiceClient() { mAvatarNameCacheConnection.disconnect(); } + sShuttingDown = true; } //--------------------------------------------------- @@ -414,6 +417,8 @@ void LLVivoxVoiceClient::terminate() mRelogRequested = false; killGateway(); } + + sShuttingDown = true; } //--------------------------------------------------- @@ -661,13 +666,13 @@ void LLVivoxVoiceClient::voiceControlCoro() U32 retry = 0; - while (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE && !LLApp::isExiting()) + while (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE && !sShuttingDown) { LL_DEBUGS("Voice") << "Suspending voiceControlCoro() momentarily for teleport. Tuning: " << mTuningMode << ". Relog: " << mRelogRequested << LL_ENDL; llcoro::suspendUntilTimeout(1.0); } - if (LLApp::isExiting()) + if (sShuttingDown) { mIsCoroutineActive = false; return; @@ -698,7 +703,7 @@ void LLVivoxVoiceClient::voiceControlCoro() << "disconnected" << " RelogRequested=" << mRelogRequested << LL_ENDL; - if (mRelogRequested) + if (mRelogRequested && !sShuttingDown) { if (!success) { @@ -713,14 +718,14 @@ void LLVivoxVoiceClient::voiceControlCoro() LL_INFOS("Voice") << "will attempt to reconnect to voice" << LL_ENDL; } - while (isGatewayRunning() || gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) + while (isGatewayRunning() || (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE && !sShuttingDown)) { LL_INFOS("Voice") << "waiting for SLVoice to exit" << LL_ENDL; llcoro::suspendUntilTimeout(1.0); } } } - while (mVoiceEnabled && mRelogRequested); + while (mVoiceEnabled && mRelogRequested && !sShuttingDown); mIsCoroutineActive = false; LL_INFOS("Voice") << "exiting" << LL_ENDL; } @@ -765,7 +770,7 @@ bool LLVivoxVoiceClient::endAndDisconnectSession() bool LLVivoxVoiceClient::callbackEndDaemon(const LLSD& data) { - if (!LLAppViewer::isExiting() && mVoiceEnabled) + if (!sShuttingDown && mVoiceEnabled) { LL_WARNS("Voice") << "SLVoice terminated " << ll_stream_notation_sd(data) << LL_ENDL; terminateAudioSession(false); @@ -919,12 +924,10 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() //--------------------------------------------------------------------- llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS); - bool quiting = LLAppViewer::isExiting(); - LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL; LLVoiceVivoxStats::getInstance()->reset(); - while (!mConnected && !quiting) + while (!mConnected && !sShuttingDown) { LLVoiceVivoxStats::getInstance()->connectionAttemptStart(); LL_DEBUGS("Voice") << "Attempting to connect to vivox daemon: " << mDaemonHost << LL_ENDL; @@ -939,12 +942,11 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() if (!mConnected) { llcoro::suspendUntilTimeout(DAEMON_CONNECT_THROTTLE_SECONDS); - quiting = LLAppViewer::isExiting(); } } //--------------------------------------------------------------------- - if (quiting && !mConnected) + if (sShuttingDown && !mConnected) { return false; } @@ -985,13 +987,11 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() { LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL; - bool quiting = LLApp::isExiting(); - while ((!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) && !quiting) + while ((!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) && !sShuttingDown) { LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL; // *TODO* Pump a message for wake up. llcoro::suspend(); - quiting = LLApp::isExiting(); } std::string url = gAgent.getRegionCapability("ProvisionVoiceAccountRequest"); @@ -1011,7 +1011,6 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() { LLVoiceVivoxStats::getInstance()->provisionAttemptStart(); result = httpAdapter->postAndSuspend(httpRequest, url, LLSD(), httpOpts); - quiting = LLApp::isExiting(); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1021,7 +1020,6 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() F32 timeout = pow(PROVISION_RETRY_TIMEOUT, static_cast(retryCount)); LL_WARNS("Voice") << "Provision CAP 404. Retrying in " << timeout << " seconds." << LL_ENDL; llcoro::suspendUntilTimeout(timeout); - quiting = LLApp::isExiting(); } else if (!status) { @@ -1033,9 +1031,9 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() { provisioned = true; } - } while (!provisioned && retryCount <= PROVISION_RETRY_MAX && !quiting); + } while (!provisioned && retryCount <= PROVISION_RETRY_MAX && !sShuttingDown); - if (quiting && !provisioned) + if (sShuttingDown && !provisioned) { return false; } @@ -1082,11 +1080,15 @@ bool LLVivoxVoiceClient::establishVoiceConnection() LL_WARNS("Voice") << "cannot establish connection; enabled "<