--- pegasus/src/Pegasus/Server/CIMOperationRequestDispatcher.cpp.obz5180 2006-07-07 18:19:11.000000000 -0400 +++ pegasus/src/Pegasus/Server/CIMOperationRequestDispatcher.cpp 2006-07-07 19:03:51.000000000 -0400 @@ -421,7 +421,18 @@ CIMResponseMessage *&response) { static const char func[] = "CIMOperationRequestDispatcher::_enqueueResponse"; - AutoMutex autoMut(_mut); + // Obtain the _enqueueResponseMutex mutex for this chunked request. + // This mutex is used to serialize chunked responses from all incoming + // provider threads. It is imperative that the sequencing done by the + // resequenceResponse() method and the writing of the chunked response + // to the connection socket (done as a synchronous enqueue at the end + // of this method) are atomic to ensure that the chunk that is marked + // as isComplete for the overall response is indeed the last chunk + // returned to the client. See PEP 140 for details. + // This mutex was moved into the OperationAggregate class as part of + // bug 4629 because we only need to serialize on a per-request basis. + // This prevents serializing independent requests on separate connections. + AutoMutex autoMut(poA->_enqueueResponseMutex); Boolean isComplete = false; try @@ -550,13 +561,6 @@ CIMException(CIM_ERR_FAILED, String(failMsg)); } - if (isComplete == true) - { - // also deletes the copied request attached to it - delete poA; - poA = 0; - } - // after sending, the response has been deleted externally response = 0; @@ -1785,6 +1789,12 @@ // the ENTIRE response to the request. isComplete = service->_enqueueResponse(poA, response); + if (isComplete) + { + // also deletes the copied request attached to it + delete poA; + poA = 0; + } PEG_METHOD_EXIT(); } --- pegasus/src/Pegasus/Server/CIMOperationRequestDispatcher.h.obz5180 2006-02-10 14:13:47.000000000 -0500 +++ pegasus/src/Pegasus/Server/CIMOperationRequestDispatcher.h 2006-07-07 19:00:43.000000000 -0400 @@ -159,6 +159,7 @@ */ class PEGASUS_SERVER_LINKAGE OperationAggregate { + friend class CIMOperationRequestDispatcher; public: /* Operation Aggregate constructor. Builds an aggregate object. @@ -227,6 +228,7 @@ Array _responseList; Mutex _appendResponseMutex; + Mutex _enqueueResponseMutex; CIMRequestMessage* _request; Uint32 _totalIssued; Uint32 _magicNumber;