From: Chris B. <buc...@us...> - 2012-03-06 17:33:57
|
Update of /cvsroot/sblim/sfcb In directory vz-cvs-3.sog:/tmp/cvs-serv7671 Modified Files: providerDrv.c providerMgr.c ChangeLog NEWS Log Message: [ 3497765 ] Better Error Handling in sfcb Provider Manager and Driver Index: NEWS =================================================================== RCS file: /cvsroot/sblim/sfcb/NEWS,v retrieving revision 1.652 retrieving revision 1.653 diff -u -d -r1.652 -r1.653 --- NEWS 5 Mar 2012 19:13:01 -0000 1.652 +++ NEWS 6 Mar 2012 17:33:55 -0000 1.653 @@ -43,6 +43,7 @@ - 3496383 Faster Return from CBDeliverIndication - 3416060 sigsegv in tool_mm_flush() - 3497096 double free during stopProc +- 3497765 Better Error Handling in sfcb Provider Manager and Driver Changes in 1.3.13 ================= Index: providerMgr.c =================================================================== RCS file: /cvsroot/sblim/sfcb/providerMgr.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- providerMgr.c 5 Mar 2012 19:11:54 -0000 1.78 +++ providerMgr.c 6 Mar 2012 17:33:55 -0000 1.79 @@ -666,9 +666,10 @@ { /* Oops, even creation of the default provider failed */ 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 { @@ -742,14 +743,16 @@ static void classProvider(int *requestor, OperationHdr * req) { int rc; + int dmy; _SFCB_ENTER(TRACE_PROVIDERMGR, "classProvider"); rc = forkProvider(classProvInfoPtr, req, 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", @@ -765,14 +768,16 @@ static void qualiProvider(int *requestor, OperationHdr * req) { int rc; + int dmy; _SFCB_ENTER(TRACE_PROVIDERMGR, "qualiProvider"); rc = forkProvider(qualiProvInfoPtr, req, 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), @@ -842,9 +847,8 @@ 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; @@ -856,9 +860,8 @@ 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; @@ -874,8 +877,6 @@ } 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); } } @@ -1237,7 +1238,9 @@ 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 */ if (resp == NULL || size == 0) { resp = calloc(sizeof(BinResponseHdr),1); @@ -1262,7 +1265,9 @@ 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 */ if (resp == NULL || size == 0) { @@ -1417,7 +1422,7 @@ irc = getProviderContext(&binCtx, &req); - if (irc) { + if (irc == MSG_X_PROVIDER) { _SFCB_TRACE(1, ("--- Invoking Provider")); resp = invokeProvider(&binCtx); resp->rc--; @@ -1428,7 +1433,11 @@ } 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); @@ -1464,9 +1473,8 @@ 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)); Index: providerDrv.c =================================================================== RCS file: /cvsroot/sblim/sfcb/providerDrv.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -d -r1.107 -r1.108 --- providerDrv.c 5 Mar 2012 19:11:36 -0000 1.107 +++ providerDrv.c 6 Mar 2012 17:33:55 -0000 1.108 @@ -2744,6 +2744,7 @@ BinRequestHdr *req = parms->req; int i,requestor=0,initRc=0; char* errstr = NULL; + char msg[1024]; _SFCB_ENTER(TRACE_PROVIDERDRV, "processProviderInvocationRequestsThread"); @@ -2755,11 +2756,26 @@ 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); } 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; @@ -2767,8 +2783,17 @@ } } 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) { Index: ChangeLog =================================================================== RCS file: /cvsroot/sblim/sfcb/ChangeLog,v retrieving revision 1.729 retrieving revision 1.730 diff -u -d -r1.729 -r1.730 --- ChangeLog 5 Mar 2012 19:12:45 -0000 1.729 +++ ChangeLog 6 Mar 2012 17:33:55 -0000 1.730 @@ -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-05 Narasimhma Sharoff <nsh...@us...> * providerDrv.c, providerMgr.c, sfcBroker.c |