From eb7bd0a214ad794db9cb2acb33c45b9d7f46b981 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 17 Dec 2009 18:00:59 -0800 Subject: Changed default launch timeout in LLPluginProcessParent to 60 seconds, and added an to LLPluginProcessParent that allows callers to adjust the launch and lockup timeouts. --- indra/llplugin/llpluginprocessparent.cpp | 24 +++++++++--------------- indra/llplugin/llpluginprocessparent.h | 7 +++++++ 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 608e444375..49f9783824 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -39,12 +39,6 @@ #include "llapr.h" -// If we don't receive a heartbeat in this many seconds, we declare the plugin locked up. -static const F32 PLUGIN_LOCKED_UP_SECONDS = 15.0f; - -// Somewhat longer timeout for initial launch. -static const F32 PLUGIN_LAUNCH_SECONDS = 20.0f; - //virtual LLPluginProcessParentOwner::~LLPluginProcessParentOwner() { @@ -59,11 +53,11 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner) mDisableTimeout = false; mDebug = false; - // initialize timer - heartbeat test (mHeartbeat.hasExpired()) - // can sometimes return true immediately otherwise and plugins - // fail immediately because it looks like -// mHeartbeat.initClass(); - mHeartbeat.setTimerExpirySec(PLUGIN_LOCKED_UP_SECONDS); + mPluginLaunchTimeout = 60.0f; + mPluginLockupTimeout = 15.0f; + + // Don't start the timer here -- start it when we actually launch the plugin process. + mHeartbeat.stop(); } LLPluginProcessParent::~LLPluginProcessParent() @@ -326,7 +320,7 @@ void LLPluginProcessParent::idle(void) // This will allow us to time out if the process never starts. mHeartbeat.start(); - mHeartbeat.setTimerExpirySec(PLUGIN_LAUNCH_SECONDS); + mHeartbeat.setTimerExpirySec(mPluginLaunchTimeout); setState(STATE_LAUNCHED); } } @@ -560,7 +554,7 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message) else if(message_name == "heartbeat") { // this resets our timer. - mHeartbeat.setTimerExpirySec(PLUGIN_LOCKED_UP_SECONDS); + mHeartbeat.setTimerExpirySec(mPluginLockupTimeout); mCPUUsage = message.getValueReal("cpu_usage"); @@ -715,7 +709,7 @@ bool LLPluginProcessParent::pluginLockedUpOrQuit() bool LLPluginProcessParent::pluginLockedUp() { - // If the timer has expired, the plugin has locked up. - return mHeartbeat.hasExpired(); + // If the timer is running and has expired, the plugin has locked up. + return (mHeartbeat.getStarted() && mHeartbeat.hasExpired()); } diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 03ce10f86c..524cd9923f 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -102,6 +102,9 @@ public: bool getDisableTimeout() { return mDisableTimeout; }; void setDisableTimeout(bool disable) { mDisableTimeout = disable; }; + + void setLaunchTimeout(F32 timeout) { mPluginLaunchTimeout = timeout; }; + void setLockupTimeout(F32 timeout) { mPluginLockupTimeout = timeout; }; F64 getCPUUsage() { return mCPUUsage; }; @@ -158,6 +161,10 @@ private: bool mDebug; LLProcessLauncher mDebugger; + + F32 mPluginLaunchTimeout; // Somewhat longer timeout for initial launch. + F32 mPluginLockupTimeout; // If we don't receive a heartbeat in this many seconds, we declare the plugin locked up. + }; #endif // LL_LLPLUGINPROCESSPARENT_H -- cgit v1.2.3