Skip to content
Snippets Groups Projects
Commit 975197f4 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Revert "SL-14988 Plugin process creation can cause a notiecable delay" Due to horrible crashes

This reverts commit d875f809.
parent 6d741502
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -75,29 +75,8 @@ class LLPluginProcessParentPollThread final : public LLThread
};
class LLPluginProcessCreationThread : public LLThread
{
public:
LLPluginProcessCreationThread(LLPluginProcessParent *parent) :
LLThread("LLPluginProcessCreationThread", gAPRPoolp),
pParent(parent)
{
}
protected:
// Inherited from LLThread, should run once
/*virtual*/ void run(void)
{
pParent->createPluginProcess();
}
private:
LLPluginProcessParent *pParent;
};
LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner):
mIncomingQueueMutex(),
pProcessCreationThread(NULL)
mIncomingQueueMutex()
{
if(!sInstancesMutex)
{
......@@ -128,18 +107,6 @@ LLPluginProcessParent::~LLPluginProcessParent()
#ifdef SHOW_DEBUG
LL_DEBUGS("Plugin") << "destructor" << LL_ENDL;
#endif
if (pProcessCreationThread)
{
if (!pProcessCreationThread->isStopped())
{
// Shouldn't happen at this stage
LL_WARNS("Plugin") << "Shutting down active pProcessCreationThread" << LL_ENDL;
pProcessCreationThread->shutdown();
ms_sleep(20);
}
delete pProcessCreationThread;
pProcessCreationThread = NULL;
}
// Destroy any remaining shared memory regions
sharedMemoryRegionsType::iterator iter;
......@@ -350,35 +317,6 @@ bool LLPluginProcessParent::accept()
return result;
}
bool LLPluginProcessParent::createPluginProcess()
{
if (!mProcess)
{
// Only argument to the launcher is the port number we're listening on
mProcessParams.args.add(stringize(mBoundPort));
mProcess = LLProcess::create(mProcessParams);
return mProcess != NULL;
}
return false;
}
void LLPluginProcessParent::clearProcessCreationThread()
{
if (pProcessCreationThread)
{
if (!pProcessCreationThread->isStopped())
{
pProcessCreationThread->shutdown();
}
else
{
delete pProcessCreationThread;
pProcessCreationThread = NULL;
}
}
}
void LLPluginProcessParent::idle(void)
{
bool idle_again;
......@@ -549,30 +487,14 @@ void LLPluginProcessParent::idle(void)
case STATE_LISTENING:
{
// Launch the plugin process.
if (mDebug && !pProcessCreationThread)
{
createPluginProcess();
if (!mProcess)
{
errorState();
}
}
else if (pProcessCreationThread == NULL)
{
// exe plugin process allocation can be hindered by a number
// of factors, don't hold whole viewer because of it, use thread
pProcessCreationThread = new LLPluginProcessCreationThread(this);
pProcessCreationThread->start();
}
else if (!mProcess && pProcessCreationThread->isStopped())
{
delete pProcessCreationThread;
pProcessCreationThread = NULL;
errorState();
}
if (mProcess)
// Only argument to the launcher is the port number we're listening on
mProcessParams.args.add(stringize(mBoundPort));
if (! (mProcess = LLProcess::create(mProcessParams)))
{
errorState();
}
else
{
if(mDebug)
{
......@@ -601,15 +523,6 @@ void LLPluginProcessParent::idle(void)
// This will allow us to time out if the process never starts.
mHeartbeat.start();
mHeartbeat.setTimerExpirySec(mPluginLaunchTimeout);
// pProcessCreationThread should have stopped by this point,
// but check just in case it paused on statistics sync
if (pProcessCreationThread && pProcessCreationThread->isStopped())
{
delete pProcessCreationThread;
pProcessCreationThread = NULL;
}
setState(STATE_LAUNCHED);
}
break;
......@@ -728,7 +641,6 @@ void LLPluginProcessParent::idle(void)
killSockets();
setState(STATE_DONE);
dirtyPollSet();
clearProcessCreationThread();
break;
}
......
......@@ -68,11 +68,6 @@ class LLPluginProcessParent final : public LLPluginMessagePipeOwner
const std::string &plugin_filename,
bool debug);
// Creates a process
// returns true if process already exists or if created,
// false if failed to create
bool createPluginProcess();
void idle(void);
// returns true if the plugin is on its way to steady state
......@@ -167,15 +162,12 @@ class LLPluginProcessParent final : public LLPluginMessagePipeOwner
bool accept();
void clearProcessCreationThread();
LLSocket::ptr_t mListenSocket;
LLSocket::ptr_t mSocket;
U32 mBoundPort;
LLProcess::Params mProcessParams;
LLProcessPtr mProcess;
LLThread *pProcessCreationThread;
std::string mPluginFile;
std::string mPluginDir;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment