#1472 Requests not marked complete when service is not found

All
closed-fixed
STAFProc (180)
5
2012-10-09
2012-10-09
Evan
No

When submitting a request with a bad service (RC 2) using the sync option ReqQueueRetain the request is never marked as complete.

Discussion

  • Sharon Lucas

    Sharon Lucas - 2012-10-09

    This problem occurs if there is a problem finding the service (e.g. RC 2) when using sync option ReqQueueRetain or ReqRetain. In this case, this the request is not being marked as complete so it is incorrectly showing up as a pending request in the request from a "STAF local SERVICE LIST REQUESTS" request. STAFProc is correctly sending a message to the queue of the handle that submitted the request telling it that the request has finished. However, STAFProc is not caling the requestCompleted(request#, result) method.

    I can see all of these bad requests sitting there as pending using 'staf local service list requests'.

     
  • Sharon Lucas

    Sharon Lucas - 2012-10-09
    • labels: --> STAFProc
    • milestone: --> All
    • assigned_to: nobody --> slucas
     
  • Sharon Lucas

    Sharon Lucas - 2012-10-09

    When the service is not found, I restructured the order of what is done to be similar to the order of what is done when the service is found. This included adding a call to requestCompleted() to occur regardless of the sync option.

    Here's a cvs diff of the changes.

    Index: stafproc/STAFProc.cpp

    RCS file: /cvsroot/staf/src/staf/stafproc/STAFProc.cpp,v
    retrieving revision 1.252
    diff -r1.252 STAFProc.cpp
    1947,1956c1947
    < if ((serviceRequest.fSyncMode != kSTAFReqRetain) &&
    < (serviceRequest.fSyncMode != kSTAFReqQueueRetain))
    < {
    < gRequestManager.requestCompleted(
    < serviceRequest.fRequestNumber, serviceResult);
    < gRequestManager.freeRequest(
    < serviceRequest.fRequestNumber, &requestResult);
    < }
    <
    < if (rc == kSTAFDoesNotExist) rc = kSTAFUnknownService;
    ---
    > // Service could not be found
    1960c1951
    < // pass back the request number
    ---
    > // Pass back the request number
    1966a1958
    > }
    1968,1986c1960,1963
    < // send the rc/result to the requester's queue
    < if ((serviceRequest.fSyncMode == kSTAFReqQueue) ||
    < (serviceRequest.fSyncMode == kSTAFReqQueueRetain))
    < {
    < // Create the message to queue. The message is a
    < // marshalled map containing the request completion
    < // information.
    <
    < STAFObjectPtr mc = STAFObject::createMarshallingContext);
    < STAFObjectPtr messageMap = STAFObject::createMap();
    < messageMap->put("requestNumber",
    < STAFString(serviceRequest.fRequestNumber));
    < messageMap->put("rc", STAFString(rc));
    < messageMap->put("result", serviceRequest.fTargetService +
    < errorBuffer);
    < mc->setRootObject(messageMap);
    < STAFString resultMessage = mc->marshall();
    <
    < // Submit the QUEUE request to the QUEUE service
    ---
    > if (rc == kSTAFDoesNotExist) rc = kSTAFUnknownService;
    >
    > serviceResult = STAFServiceResult(
    > rc, serviceRequest.fTargetService + errorBuffer);
    1988,1990c1965,1966
    < STAFString queueRequest(sQueueHandle +
    < serviceRequest.fHandle);
    < queueRequest += sType + sRequestComplete;
    ---
    > gRequestManager.requestCompleted(
    > serviceRequest.fRequestNumber, serviceResult);
    1992,1994c1968,1972
    < queueRequest += sMessage + sColon +
    < resultMessage.length(STAFString::kChar) + sColon +
    < resultMessage;
    ---
    > if ((serviceRequest.fSyncMode == kSTAFReqQueue) ||
    > (serviceRequest.fSyncMode == kSTAFReqQueueRetain))
    > {
    > // Create the message to queue. The message is a marshalled
    > // map containing the request completion information.
    1996,1998c1974,1991
    < gSTAFProcHandlePtr->submit(sLocal, sQueue, queueRequest,
    < kSTAFReqFireAndForget);
    < }
    ---
    > STAFObjectPtr mc = STAFObject::createMarshallingContext();
    > STAFObjectPtr messageMap = STAFObject::createMap();
    > messageMap->put("requestNumber",
    > STAFString(serviceRequest.fRequestNumber));
    > messageMap->put("rc", STAFString(rc));
    > messageMap->put("result", serviceResult.fResult);
    > mc->setRootObject(messageMap);
    > STAFString resultMessage = mc->marshall();
    >
    > // Submit the QUEUE request to the QUEUE service
    >
    > STAFString queueRequest(sQueueHandle +
    > serviceRequest.fHandle);
    > queueRequest += sType + sRequestComplete;
    >
    > queueRequest += sMessage + sColon +
    > resultMessage.length(STAFString::kChar) + sColon +
    > resultMessage;
    2000c1993,2001
    < return STAFServiceResult(kSTAFOk);
    ---
    > gSTAFProcHandlePtr->submit(sLocal, sQueue, queueRequest,
    > kSTAFReqFireAndForget);
    > }
    >
    > if ((serviceRequest.fSyncMode != kSTAFReqRetain) &&
    > (serviceRequest.fSyncMode != kSTAFReqQueueRetain))
    > {
    > gRequestManager.freeRequest(serviceRequest.fRequestNumber,
    > &requestResult);
    2003,2004c2004
    < return STAFServiceResult(
    < rc, serviceRequest.fTargetService + errorBuffer);
    ---

     
  • Sharon Lucas

    Sharon Lucas - 2012-10-09
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks