From: Chris B. <buc...@us...> - 2012-03-06 20:21:33
|
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 c7aea3d3eeda8b9d80fea5f14b0e00e18fdd73db (commit) via 9397bdf60022646c8eca8eb2533f6d340b97b75f (commit) from cfbfd79f009a11a272c4edd1e281743bd597044a (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 c7aea3d3eeda8b9d80fea5f14b0e00e18fdd73db Merge: 9397bdf cfbfd79 Author: buccella <buc...@li...> Date: Tue Mar 6 15:22:10 2012 -0500 merge Changelog and NEWS commit 9397bdf60022646c8eca8eb2533f6d340b97b75f Author: buccella <buc...@li...> Date: Tue Mar 6 15:20:04 2012 -0500 [ 3497765 ] Better Error Handling in sfcb Provider Manager and Driver ----------------------------------------------------------------------- Summary of changes: diff --git a/ChangeLog b/ChangeLog index 39189b2..afdb7c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-03-06 Chris Buccella <buc...@li...> + + * providerDrv.c, providerMgr.c: + [ 3497765 ] Better Error Handling in sfcb Provider Manager and Driver + (patch by Viktor Mihajlovski) + 2012-03-06 Dave Heller <hel...@us...> * extra/sfcb-ps: diff --git a/NEWS b/NEWS index d64b625..26ff00c 100644 --- a/NEWS +++ b/NEWS @@ -106,6 +106,7 @@ Bugs Fixed: - 3495801 Correction to 3495343 - 3496061 IndicationSubscription May Be Undeletable - 3496383 Faster Return from CBDeliverIndication +- 3497765 Better Error Handling in sfcb Provider Manager and Driver Changes in 1.3.13 ================= diff --git a/providerDrv.c b/providerDrv.c index 038f16e..d0b202b 100644 --- a/providerDrv.c +++ b/providerDrv.c @@ -3163,6 +3163,7 @@ processProviderInvocationRequestsThread(void *prms) requestor = 0, initRc = 0; char *errstr = NULL; + char msg[1024]; _SFCB_ENTER(TRACE_PROVIDERDRV, "processProviderInvocationRequestsThread"); @@ -3180,14 +3181,30 @@ processProviderInvocationRequestsThread(void *prms) if (req->operation != OPS_LoadProvider) { if (req->provId == NULL) { - mlogf(M_ERROR, M_SHOW, - "-#- no provider id specified for request --- terminating process.\n"); + mlogf(M_ERROR,M_SHOW,"-#- no provider id specified for request --- terminating process (%d).\n", currentProc); + snprintf(msg,1023, "*** Provider id not specified (%d), exiting", + currentProc); + resp = errorCharsResp(CMPI_RC_ERR_FAILED, msg); + sendResponse(abs(parms->requestor), resp); + free(resp); exit(-1); } /* Update lastActivity time for the process and for * the specific provider being requested. */ time(&curProvProc->lastActivity); + + if (activProvs == NULL) { + /* only load provider allowed, exiting should allow for recovery via reload */ + mlogf(M_ERROR,M_SHOW,"-#- potential race condition in provider reload --- terminating process (%d).\n", currentProc); + snprintf(msg,1023, "*** Provider not yet loaded (%d), exiting", + currentProc); + resp = errorCharsResp(CMPI_RC_ERR_FAILED, msg); + sendResponse(abs(parms->requestor), resp); + free(resp); + exit(-1); + } + for (pInfo = activProvs; pInfo; pInfo = pInfo->next) { if (pInfo->provIds.ids == req->provId) { pInfo->lastActivity = curProvProc->lastActivity; @@ -3195,9 +3212,17 @@ processProviderInvocationRequestsThread(void *prms) } } if (pInfo == NULL) { - mlogf(M_ERROR, M_SHOW, - "-#- Serious provider id / provider process mismatch --- terminating process.\n"); - exit(-1); + /* probably a race, however this provider is still alive, keep it running */ + mlogf(M_ERROR,M_SHOW,"-#- misdirected provider request (%d) --- skipping request, keep process (%d).\n", req->operation, currentProc); + if (req->operation == OPS_InvokeMethod) { + fprintf(stderr,"method: %s",(char*)((InvokeMethodReq*)req)->method.data); + } + snprintf(msg,1023, "*** Misdirected provider request (%d)", + currentProc); + resp = errorCharsResp(CMPI_RC_ERR_FAILED, msg); + sendResponse(abs(parms->requestor), resp); + free(resp); + _SFCB_RETURN(NULL); } if (pInfo->library == NULL) { diff --git a/providerMgr.c b/providerMgr.c index f75a212..ff29cc0 100644 --- a/providerMgr.c +++ b/providerMgr.c @@ -717,11 +717,10 @@ assocProviderList(int *requestor, OperationHdr * req) */ mlogf(M_ERROR, M_SHOW, "--- forkProvider failed for defaultProvider\n"); - /* - * spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, - * NULL, req->options); - */ - _SFCB_ABORT(); + spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, + NULL, req->options); + // _SFCB_ABORT(); + _SFCB_EXIT(); } } else { spSendCtlResult(requestor, &sfcbSockets.send, MSG_X_PROVIDER_NOT_FOUND, @@ -796,15 +795,15 @@ static void classProvider(int *requestor, OperationHdr * req) { int rc; + int dmy; _SFCB_ENTER(TRACE_PROVIDERMGR, "classProvider"); rc = forkProvider(classProvInfoPtr, NULL); if (rc != CMPI_RC_OK) { mlogf(M_ERROR, M_SHOW, "--- forkProvider failed in classProvider\n"); - /* - * spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, NULL, - * req->options); - */ - _SFCB_ABORT(); + spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, + NULL, req->options); + // _SFCB_ABORT(); + _SFCB_EXIT(); } _SFCB_TRACE(1, ("--- result %d-%lu to with %d-%lu", @@ -822,15 +821,15 @@ static void qualiProvider(int *requestor, OperationHdr * req) { int rc; + int dmy; _SFCB_ENTER(TRACE_PROVIDERMGR, "qualiProvider"); rc = forkProvider(qualiProvInfoPtr, NULL); if (rc != CMPI_RC_OK) { mlogf(M_ERROR, M_SHOW, "--- forkProvider failed in qualiProvider\n"); - /* - * spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, NULL, - * req->options); - */ - _SFCB_ABORT(); + spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, + NULL, req->options); + // _SFCB_ABORT(); + _SFCB_EXIT(); } _SFCB_TRACE(1, ("--- result %d-%lu to with %d-%lu", *requestor, getInode(*requestor), @@ -903,11 +902,8 @@ _methProvider(BinRequestContext * ctx, OperationHdr * req) if (rc != CMPI_RC_OK) { mlogf(M_ERROR, M_SHOW, "--- forkProvider failed in _methProvider (%s)\n", className); - /* - * spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, - * NULL, req->options); - */ - _SFCB_ABORT(); + // _SFCB_ABORT(); + _SFCB_RETURN(MSG_X_PROVIDER_NOT_FOUND); } ctx->provA.ids = getProvIds(classProvInfoPtr); ctx->provA.socket = classProvInfoPtr->providerSockets.send; @@ -918,11 +914,8 @@ _methProvider(BinRequestContext * ctx, OperationHdr * req) if (rc != CMPI_RC_OK) { mlogf(M_ERROR, M_SHOW, "--- forkProvider failed in _methProvider (%s)\n", className); - /* - * spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, - * NULL, req->options); - */ - _SFCB_ABORT(); + // _SFCB_ABORT(); + _SFCB_RETURN(MSG_X_PROVIDER_NOT_FOUND); } ctx->provA.ids = getProvIds(interOpProvInfoPtr); ctx->provA.socket = interOpProvInfoPtr->providerSockets.send; @@ -936,10 +929,6 @@ _methProvider(BinRequestContext * ctx, OperationHdr * req) _SFCB_RETURN(MSG_X_PROVIDER); } else { mlogf(M_ERROR, M_SHOW, "--- _methProvider NOT FOUND\n"); - /* - * spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, - * NULL, req->options); - */ _SFCB_RETURN(MSG_X_PROVIDER_NOT_FOUND); } } @@ -1335,9 +1324,11 @@ intInvokeProvider(BinRequestContext * ctx, ComSockets sockets) if (resp) free(resp); resp = NULL; - // spRecvResult(&resultSockets.receive, &fromS, (void**) &resp, - // &size); - spRecvResult(&sockets.receive, &fromS, (void **) &resp, &size); + + if (spRecvResult(&sockets.receive, &fromS, (void**) &resp, &size) < 0) { + size = 0; /* force failure handling */ + } + /* * nothing received -- construct a failure response */ @@ -1365,9 +1356,10 @@ intInvokeProvider(BinRequestContext * ctx, ComSockets sockets) } else if ((ctx->noResp & 1) == 0) { - // spRecvResult(&resultSockets.receive, &fromS, (void **) &resp, - // &size); - spRecvResult(&sockets.receive, &fromS, (void **) &resp, &size); + + if (spRecvResult(&sockets.receive, &fromS, (void **) &resp, &size) < 0) { + size = 0; /* force failure case */ + } /* * nothing received -- construct a failure response @@ -1522,7 +1514,7 @@ getConstClass(const char *ns, const char *cn) irc = getProviderContext(&binCtx); - if (irc) { + if (irc == MSG_X_PROVIDER) { _SFCB_TRACE(1, ("--- Invoking Provider")); resp = invokeProvider(&binCtx); resp->rc--; @@ -1532,8 +1524,11 @@ getConstClass(const char *ns, const char *cn) memAdd(ccl, &x); } else ccl = NULL; - } else - ccl = NULL; + } else { + mlogf(M_ERROR,M_SHOW,"-- no provider context getConstClass(%s:%s)\n", + ns, cn); + ccl = NULL; /* sufficient error indication ? */ + } unlockUpCall(Broker); @@ -1571,11 +1566,8 @@ _getConstClass(const char *ns, const char *cn, CMPIStatus *st) if (irc != CMPI_RC_OK) { mlogf(M_ERROR, M_SHOW, "--- forkProvider failed in _getConstClass(%s:%s)\n", ns, cn); - /* - * spSendCtlResult(requestor, &dmy, MSG_X_PROVIDER_NOT_FOUND, 0, NULL, - * req->options); - */ - _SFCB_ABORT(); + // _SFCB_ABORT(); + _SFCB_RETURN(NULL); } memset(&binCtx, 0, sizeof(BinRequestContext)); hooks/post-receive -- SFCB - Small Footprint CIM Broker |