From: Michael Chase-S. <mc...@us...> - 2012-06-29 16:18:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "SFCB - Small Footprint CIM Broker". The branch, master has been updated via f2b9c05c7b13844039009806325e536b50264385 (commit) from c82bc87d88c184684a25b6b2e340c44f7a06b98b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f2b9c05c7b13844039009806325e536b50264385 Author: Michael Chase-Salerno <br...@li...> Date: Fri Jun 29 12:18:10 2012 -0400 [ 3539006 ] Possible indication deadlock ----------------------------------------------------------------------- Summary of changes: diff --git a/ChangeLog b/ChangeLog index ccb166f..ff68cb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-06-29 Michael Chase-Salerno <br...@li...> + + * brokerUpc.c, indCIMXMLExport.c, indCIMXMLHandler.c, interopProvider.c, + support.c, support.h: + + [ 3539006 ] Possible indication deadlock + 2012-06-28 Narasimha Sharoff <nsh...@us...> * cimslpCMPI.c: [ 3538848 ] compile error in cimslpCMPI.c:291 diff --git a/NEWS b/NEWS index 26d8299..6acf4fc 100644 --- a/NEWS +++ b/NEWS @@ -92,6 +92,13 @@ Everything in 1.3.10, plus: - 3104761 cimRsRequest.h missing from make-dist tarball - 3107553 Remove Large Volume Support +Changes in 1.3.16 +================= + +Bugs fixed: + +- 3539006 Possible indication deadlock + Changes in 1.3.15 ================= diff --git a/brokerUpc.c b/brokerUpc.c index 1abe89f..6e5fba1 100644 --- a/brokerUpc.c +++ b/brokerUpc.c @@ -266,6 +266,10 @@ setContext(BinRequestContext * binCtx, OperationHdr * oHdr, bHdr->sessionId = ctx->ft->getEntry(ctx, "CMPISessionId", NULL).value.uint32; + ctxData = ctx->ft->getEntry(ctx, "noResp", NULL); + binCtx->noResp = (ctxData.state == CMPI_nullValue) ? 0 : ctxData.value.boolean; + + binCtx->oHdr = oHdr; binCtx->bHdr = bHdr; binCtx->bHdrSize = size; @@ -862,7 +866,7 @@ deleteInstance(const CMPIBroker * broker, const CMPIContext *context, const CMPIObjectPath * cop) { BinRequestContext binCtx; - BinResponseHdr *resp; + BinResponseHdr *resp = NULL; DeleteInstanceReq sreq = BINREQ(OPS_DeleteInstance, DI_REQ_REG_SEGMENTS); OperationHdr oHdr = { OPS_DeleteInstance, 2 }; CMPIStatus st = { CMPI_RC_OK, NULL }; @@ -911,9 +915,11 @@ deleteInstance(const CMPIBroker * broker, resp = invokeProvider(&binCtx); closeProviderContext(&binCtx); - resp->rc--; - buildStatus(resp, &st); - free(resp); + if (resp) { + resp->rc--; + buildStatus(resp, &st); + free(resp); + } } else st = setErrorStatus(irc); diff --git a/indCIMXMLExport.c b/indCIMXMLExport.c index 159a77c..c260477 100644 --- a/indCIMXMLExport.c +++ b/indCIMXMLExport.c @@ -259,6 +259,8 @@ genRequest(CurlData * cd, char *url, char **msg) // Fail if we receive an error (HTTP response code >= 300) rv = curl_easy_setopt(cd->mHandle, CURLOPT_FAILONERROR, 1); + rv = curl_easy_setopt(cd->mHandle, CURLOPT_NOSIGNAL, 1); + // Turn this on to enable debugging // rv = curl_easy_setopt(cd->mHandle, CURLOPT_VERBOSE, 1); diff --git a/indCIMXMLHandler.c b/indCIMXMLHandler.c index 2250118..fc82735 100644 --- a/indCIMXMLHandler.c +++ b/indCIMXMLHandler.c @@ -35,6 +35,7 @@ #include "native.h" #include "control.h" #include "instance.h" +#include "support.h" extern void closeProviderContext(BinRequestContext * ctx); extern int exportIndication(char *url, char *payload, char **resp, @@ -881,7 +882,8 @@ retryExport(void *lctx) // 2, delete the sub; 3, disable the sub; otherwise, nothing if (ract == 2) { _SFCB_TRACE(1,("--- Subscription threshold reached, deleting.")); - CBDeleteInstance(_broker, ctx, cur->sub); + CMPIContext *ctxDel = prepareNorespCtx(ctx); + CBDeleteInstance(_broker, ctxDel, cur->sub); purge = cur; cur = cur->next; dqRetry(ctx,purge); diff --git a/interopProvider.c b/interopProvider.c index d5ee835..a7e8e7d 100644 --- a/interopProvider.c +++ b/interopProvider.c @@ -94,6 +94,12 @@ static UtilHashTable *filterHt = NULL; static UtilHashTable *handlerHt = NULL; static UtilHashTable *subscriptionHt = NULL; +// Mutex's to protect the hash tables +static pthread_mutex_t filterHTlock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t handlerHTlock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t subHTlock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t subDelLock = PTHREAD_MUTEX_INITIALIZER; + /* for indication delivery */ static long MAX_IND_THREADS; static long IND_THREAD_TO; @@ -155,6 +161,7 @@ addSubscription(const CMPIInstance *ci, _SFCB_ENTER(TRACE_INDPROVIDER, "addSubscription"); + pthread_mutex_lock(&subHTlock); if (subscriptionHt == NULL) { subscriptionHt = UtilFactory->newHashTable(61, UtilHashTable_charKey); subscriptionHt->ft->setReleaseFunctions(subscriptionHt, free, NULL); @@ -163,9 +170,10 @@ addSubscription(const CMPIInstance *ci, _SFCB_TRACE(1, ("-- Subscription: %s\n", key)); su = subscriptionHt->ft->get(subscriptionHt, key); - if (su) + if (su) { + pthread_mutex_unlock(&subHTlock); _SFCB_RETURN(NULL); - + } su = (Subscription *) malloc(sizeof(Subscription)); su->sci = CMClone(ci, NULL); su->fi = fi; @@ -174,6 +182,7 @@ addSubscription(const CMPIInstance *ci, ha->useCount++; subscriptionHt->ft->put(subscriptionHt, key, su); + pthread_mutex_unlock(&subHTlock); _SFCB_RETURN(su); } @@ -204,6 +213,7 @@ removeSubscription(Subscription * su, char *key) { _SFCB_ENTER(TRACE_INDPROVIDER, "removeSubscription"); + pthread_mutex_lock(&subHTlock); if (subscriptionHt) { subscriptionHt->ft->remove(subscriptionHt, key); if (su) { @@ -214,10 +224,13 @@ removeSubscription(Subscription * su, char *key) } } if (su) { - CMRelease(su->sci); + if (su->sci) { + CMRelease(su->sci); + } free(su); } + pthread_mutex_unlock(&subHTlock); _SFCB_EXIT(); } @@ -239,14 +252,17 @@ addFilter(const CMPIInstance *ci, _SFCB_TRACE(1, ("--- Filter: >%s<", key)); _SFCB_TRACE(1, ("--- query: >%s<", query)); + pthread_mutex_lock(&filterHTlock); if (filterHt == NULL) { filterHt = UtilFactory->newHashTable(61, UtilHashTable_charKey); filterHt->ft->setReleaseFunctions(filterHt, free, NULL); } fi = filterHt->ft->get(filterHt, key); - if (fi) + if (fi) { + pthread_mutex_unlock(&filterHTlock); _SFCB_RETURN(NULL); + } fi = (Filter *) malloc(sizeof(Filter)); fi->fci = CMClone(ci, NULL); @@ -259,6 +275,7 @@ addFilter(const CMPIInstance *ci, else fi->snsa = NULL; fi->type = NULL; filterHt->ft->put(filterHt, key, fi); + pthread_mutex_unlock(&filterHTlock); _SFCB_RETURN(fi); } @@ -290,6 +307,7 @@ removeFilter(Filter * fi, char *key) { _SFCB_ENTER(TRACE_INDPROVIDER, "removeFilter"); + pthread_mutex_lock(&filterHTlock); if (filterHt) { filterHt->ft->remove(filterHt, key); } @@ -303,6 +321,7 @@ removeFilter(Filter * fi, char *key) free(fi); } + pthread_mutex_unlock(&filterHTlock); _SFCB_EXIT(); } @@ -318,6 +337,7 @@ addHandler(CMPIInstance *ci, CMPIObjectPath * op) _SFCB_ENTER(TRACE_INDPROVIDER, "addHandler"); + pthread_mutex_lock(&handlerHTlock); if (handlerHt == NULL) { handlerHt = UtilFactory->newHashTable(61, UtilHashTable_charKey); handlerHt->ft->setReleaseFunctions(handlerHt, free, NULL); @@ -331,6 +351,7 @@ addHandler(CMPIInstance *ci, CMPIObjectPath * op) _SFCB_TRACE(1, ("--- Handler already registered %p", ha)); if (key) free(key); + pthread_mutex_unlock(&handlerHTlock); _SFCB_RETURN(NULL); } @@ -340,6 +361,7 @@ addHandler(CMPIInstance *ci, CMPIObjectPath * op) ha->useCount = 0; handlerHt->ft->put(handlerHt, key, ha); + pthread_mutex_unlock(&handlerHTlock); _SFCB_RETURN(ha); } @@ -370,6 +392,7 @@ removeHandler(Handler * ha, char *key) { _SFCB_ENTER(TRACE_INDPROVIDER, "removeHandler"); + pthread_mutex_lock(&handlerHTlock); if (handlerHt) { handlerHt->ft->remove(handlerHt, key); } @@ -379,10 +402,10 @@ removeHandler(Handler * ha, char *key) free(ha); } + pthread_mutex_unlock(&handlerHTlock); _SFCB_EXIT(); } - /* * Similar to addHandler(), but useCount is maintained * don't need to check for handlerHt because we only get here @@ -401,10 +424,12 @@ static Handler *updateHandler(CMPIInstance *ci, _SFCB_TRACE(1,("--- Handler: %s",key)); + pthread_mutex_lock(&handlerHTlock); // do we need to check?? if ((ha=handlerHt->ft->get(handlerHt,key))==NULL) { _SFCB_TRACE(1,("--- No handler %p",ha)); if(key) free( |