summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordl.meetei <dl.meetei>2013-06-28 08:41:55 +0000
committerdl.meetei <dl.meetei>2013-06-28 08:41:55 +0000
commitf17e9c764070f1dc2a8d99eae8328417f8d02bed (patch)
treefaad732c7a60142186d1cb26d1f4f34558d0e65e
parente3f60e8b4f20de899944fd17fa04e0dfcba14c71 (diff)
downloadtog-pegasus-RELEASE_2_12-branch.zip
tog-pegasus-RELEASE_2_12-branch.tar.gz
tog-pegasus-RELEASE_2_12-branch.tar.xz
TITLE: ProviderAgent still not exiting after first clean up DESCRIPTION:
-rw-r--r--src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.cpp123
-rw-r--r--src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.h7
-rw-r--r--src/Pegasus/msg/Server/pegasusServer_en.txt7
3 files changed, 83 insertions, 54 deletions
diff --git a/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.cpp b/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.cpp
index 8d62d7f..6f394c0 100644
--- a/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.cpp
+++ b/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.cpp
@@ -140,6 +140,21 @@ ProviderAgent::~ProviderAgent()
PEG_METHOD_EXIT();
}
+//get the shutdown timeout value
+static Uint32 getShutdownTimeout()
+{
+ ConfigManager *cfgManager = ConfigManager::getInstance();
+ String shutdnTimestr = cfgManager ->getCurrentValue( "shutdownTimeout");
+
+ Uint64 shutdownTimeout = 0;
+
+ StringConversion::decimalStringToUint64(
+ shutdnTimestr.getCString(), shutdownTimeout);
+
+ return (Uint32) shutdownTimeout;
+}
+
+
void ProviderAgent::run()
{
PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::run");
@@ -204,16 +219,7 @@ void ProviderAgent::run()
CIMStopAllProvidersRequestMessage *stopRequest =
new CIMStopAllProvidersRequestMessage("0", QueueIdStack(0));
- ConfigManager *cfgManager = ConfigManager::getInstance();
- const char* shutdnTimestr =
- (const char*)cfgManager ->getCurrentValue(
- "shutdownTimeout").getCString();
- Uint64 tmp = 0;
-
- StringConversion::stringToUnsignedInteger ( shutdnTimestr, tmp);
- Uint32 shutdownTimeout = Uint32(tmp);
-
- stopRequest->shutdownTimeout = shutdownTimeout;
+ stopRequest->shutdownTimeout = getShutdownTimeout();
_processStopAllProvidersRequest(stopRequest);
}
}
@@ -261,7 +267,6 @@ Boolean ProviderAgent::_readAndProcessRequest()
PEG_METHOD_ENTER(TRC_PROVIDERAGENT,
"ProviderAgent::_readAndProcessRequest");
-
//
// Read the request from CIM Server
//
@@ -352,16 +357,20 @@ Boolean ProviderAgent::_readAndProcessRequest()
return false;
}
- try
+ if(!_unloadIdleProviders())
{
- _unloadIdleProviders();
- }
- catch (...)
- {
- // Ignore exceptions from idle provider unloading
- PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL2,
- "Ignoring exception from _unloadIdleProviders()");
+ PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL3,
+ "unloading can not be completed now.");
+ Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
+ MessageLoaderParms(
+ "ProviderManager.ProviderAgent.ProviderAgent."
+ "PROVIDERS_FAILED_TO_UNLOAD",
+ "Provider agent \"{0}\" failed to unload and exit within"
+ "\"{1}\" seconds during idle cleanup."
+ " It will be exited in the next idle clean up.",
+ _agentId, getShutdownTimeout() ));
}
+
PEG_METHOD_EXIT();
return false;
}
@@ -910,50 +919,58 @@ void ProviderAgent::_responseChunkCallback(
PEG_METHOD_EXIT();
}
-void ProviderAgent::_unloadIdleProviders()
+
+Boolean ProviderAgent::_unloadIdleProviders()
{
PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::_unloadIdleProviders");
- ThreadStatus rtn = PEGASUS_THREAD_OK;
-
- // Ensure that only one _unloadIdleProvidersHandler thread runs at a time
- _unloadIdleProvidersBusy++;
-
- if ((_unloadIdleProvidersBusy.get() == 1) &&
- ((rtn =_threadPool.allocate_and_awaken(
- (void*)this,
- ProviderAgent::_unloadIdleProvidersHandler)) == PEGASUS_THREAD_OK))
- {
- // _unloadIdleProvidersBusy is decremented in
- // _unloadIdleProvidersHandler
- }
- else
- {
- // If we fail to allocate a thread, don't retry now.
- _unloadIdleProvidersBusy--;
- }
- if (rtn != PEGASUS_THREAD_OK)
+ try
{
- PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
- "Could not allocate thread to unload idle providers.");
- }
+ ThreadStatus rtn = PEGASUS_THREAD_OK;
- // Wait for the cleanup thread to finish
- ConfigManager *cfgManager = ConfigManager::getInstance();
- const char* shutdnTimestr = (const char*)cfgManager ->getCurrentValue(
- "shutdownTimeout").getCString();
- Uint64 tmp = 0;
+ //Ensure that only one _unloadIdleProvidersHandler thread runs at a time
+ _unloadIdleProvidersBusy++;
- StringConversion::stringToUnsignedInteger ( shutdnTimestr, tmp);
- Uint32 shutdownTimeout = Uint32(tmp);
+ if ((_unloadIdleProvidersBusy.get() == 1) &&
+ ((rtn =_threadPool.allocate_and_awaken(
+ (void*)this,
+ ProviderAgent::_unloadIdleProvidersHandler))
+ == PEGASUS_THREAD_OK))
+ {
+ // _unloadIdleProvidersBusy is decremented in
+ // _unloadIdleProvidersHandler
+ }
+ else
+ {
+ // If we fail to allocate a thread, don't retry now.
+ _unloadIdleProvidersBusy--;
+ }
+ if (rtn != PEGASUS_THREAD_OK)
+ {
+ PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
+ "Could not allocate thread to unload idle providers.");
+ }
- while (_unloadIdleProvidersBusy.get() > 0 && shutdownTimeout > 0 )
+ // Wait for the cleanup thread to finish
+ Uint32 shutdownTimeout = getShutdownTimeout();
+ while (_unloadIdleProvidersBusy.get() > 0 && shutdownTimeout > 0 )
+ {
+ Threads::yield();
+ Threads::sleep(1000);
+ shutdownTimeout--;
+ }
+ }
+ catch ( ...)
{
- Threads::yield();
- Threads::sleep(1000);
- shutdownTimeout--;
+ PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL3,
+ "Unexpected exception during unload idle providers.");
+
+ PEG_METHOD_EXIT();
+ return false;
+
}
PEG_METHOD_EXIT();
+ return _unloadIdleProvidersBusy.get() == 0;
}
ThreadReturnType PEGASUS_THREAD_CDECL
diff --git a/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.h b/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.h
index 03901dd..a6064bb 100644
--- a/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.h
+++ b/src/Pegasus/ProviderManagerService/ProviderAgent/ProviderAgent.h
@@ -135,7 +135,12 @@ private:
static void _responseChunkCallback(
CIMRequestMessage* request, CIMResponseMessage* response);
- void _unloadIdleProviders();
+ /*
+ *Tries to unload idle providers giving a timeout of value shutdown timeout
+ * return true if unloaded successfuly
+ */
+ Boolean _unloadIdleProviders();
+
static ThreadReturnType PEGASUS_THREAD_CDECL
_unloadIdleProvidersHandler(void* arg) throw();
diff --git a/src/Pegasus/msg/Server/pegasusServer_en.txt b/src/Pegasus/msg/Server/pegasusServer_en.txt
index 35bca47..b8a7edb 100644
--- a/src/Pegasus/msg/Server/pegasusServer_en.txt
+++ b/src/Pegasus/msg/Server/pegasusServer_en.txt
@@ -5737,6 +5737,13 @@ CIM server listening on HTTPS port {0}."}
*/
ProviderManager.ProviderAgent.ProviderAgent.PROVIDERS_FAILED_TO_CLEANUP:string {"PGS14006: Providers in the agent \"{0}\" have failed to cleanup within \"{1}\" seconds during the shutdown. Provider agent terminated forcibly."}
+ /**
+ * @note PGS14007
+ * Substitution {0} is the provider agent name.
+ * Substitution {1} is the shutdown timeout in seconds
+ */
+ ProviderManager.ProviderAgent.ProviderAgent.PROVIDERS_FAILED_TO_UNLOAD:string {"PGS14007: Provider agent \"{0}\" failed to unload and exit within \"{1}\" seconds during idle cleanup. It will be exited in the next idle clean up."}
+
// ==========================================================
// Messages for Common.Monitor
// Please use message prefix "PGS14200"