Windows app crash with Pegasus library 2.91 when compiled with /MT option

Bala Gopalakrishnan <[email protected]>
Newsgroups gmane.network.open-pegasus.general
Message-ID <[email protected]>
Our company has an Windows application that uses Open Pegasus common and
client library/dll to communicate with ESX Vmware in-box cimmon. Currently
we use Pegasus 2.71 version library/dll built with VC++ 6.0. We are facing
issues when we attempt to move to 2.91 version to support x64 and Itanium
builds. We use Visual Studio 2008 professional  and Team edition. Our
company has a restriction not have dependency on Microsoft redistributables.
The default build done with /MD option has dependency on msvcrt90.dll and
msvcrp90.dll files. To remove the dependency I used the following flag
PEGASUS_EXTRA_CXX_FLAGS=-MT. This flag did remove the dependency but causes
the application to crash. Application built with default /MD option doesn't
crash. Even the cimcli program built with /MT option crashes. Please see the
below environment variables that I use.



set PEGDIR=%cd%\

set PEGASUS_ROOT=%PEGDIR%

set PEGASUS_HOME=%PEGASUS_ROOT%

set PEGASUS_PLATFORM=WIN32_IX86_MSVC

set PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER=false

set PEGASUS_EXTRA_CXX_FLAGS=-MT

set PEGASUS_ENABLE_SLP=false

cd %PEGASUS_ROOT%

make clobber

cd %PEGASUS_ROOT%\src\Pegasus\Common

make -f Makefile

cd %PEGASUS_ROOT%\src\Pegasus\Client

make -f Makefile





I believe the crash happen when the Highlighted Array<HTTPHeader> header
goes out of scope, stack unwinds calling its destructor.



$PEGASUS_HOME\src\Pegasus\Client\CIMOperationRequestEncoder.cpp



    HTTPMessage * http_request = new HTTPMessage(buffer);



    // these variables are needed to call HTTPMessage::parse, all we need

    // is contentLength

    String startLine;

    Array<HTTPHeader> headers;

    Uint32 contentLength;



    http_request->parse(startLine, headers, contentLength);

    if (dataStore_prt)

    {

        dataStore_prt->setRequestSize(contentLength);

        dataStore_prt->setStartNetworkTime();

    }



    _outputQueue->enqueue(http_request);

}







The operator delete causes crash. File name is
$PEGASUS_HOME\src\Pegasus\Common\ArrayRep.h



template<class T>

inline void ArrayRep<T>::unref(const ArrayRep<T>* rep_)

{

    ArrayRep<T>* rep = (ArrayRep<T>*)rep_;



    if (rep != &ArrayRepBase::_empty_rep && rep->refs.decAndTestIfZero())

    {

        Destroy(rep->data(), rep->size);

        rep->refs.~AtomicInt();

      ::operator delete(rep);

    }

}





If I comment out the delete operator in unref(const ArrayRep<T>* rep_)
method in  Pegasus\Common\ArrayRep.h     file the crash goes away. But this
is also causing huge memory leaks in my application. Any help is
appreciated.



Thanks,

Bala Gopalakrishnan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.