Results 1 to 4 of 4

Thread: Possible memory leak in Ice 3.4.2 glacier2router executable

  1. #1
    paolo is offline Registered User
    Name: paolo volpi
    Organization: tvblob
    Project: tvblob blobbox
    Join Date
    Aug 2007
    Posts
    22

    Possible memory leak in Ice 3.4.2 glacier2router executable

    Using chat demo server (with plain tcp instead of ssl and DemoGlacier2/NullPermissionsVerifier) and the following test client code, glacier2router start growing in memory size occupation till eating all the memory of the system (Linux ubuntu 10.04 & opensuse 11.4).

    /////////////////////////////////////////////////////////////////////////////7

    include <Ice/Ice.h>
    #include <IceUtil/IceUtil.h>
    #include <Glacier2/Glacier2.h>
    #include <Chat.hpp>
    using namespace std;

    int doit(const Ice::CommunicatorPtr& icPtr)
    {
    Glacier2::RouterPrx routerPrx;
    Demo::ChatSessionPrx chatSessionPrx;

    try
    {
    routerPrx = Glacier2::RouterPrx::checkedCast(icPtr->getDefaultRouter());
    chatSessionPrx= Demo::ChatSessionPrx::checkedCast(routerPrx->createSession("user", "pwd"));
    chatSessionPrx->ice_ping();
    chatSessionPrx->destroy();
    routerPrx->destroySession();
    return 0;
    }
    catch (const Ice::Exception& ex)
    {
    cerr << "Glacier Connection Failed with " << ex.ice_name() << endl;
    return -1;
    }
    }

    int main(int argc, char* argv[])
    {
    Ice::CommunicatorPtr icPtr;
    icPtr = Ice::initialize(argc, argv);
    unsigned long counter(0);
    for(;;++counter)
    {
    if(doit(icPtr))
    exit(-10);

    usleep(500);
    if (!(counter % 100))
    cout << "Counter : " << counter << endl;
    }

    return 0;
    }

    ////////////////////////////////////////////////////////////////////////////////////////

    Running glacier2router with valgrind --leak-check=full doing only one iteration of the test client showed this is the result:

    ==2004== LEAK SUMMARY:
    ==2004== definitely lost: 384 bytes in 2 blocks
    ==2004== indirectly lost: 11,324 bytes in 56 blocks
    ==2004== possibly lost: 1,691 bytes in 33 blocks
    ==2004== still reachable: 2,680 bytes in 25 blocks
    ==2004== suppressed: 0 bytes in 0 blocks
    ==2004== Reachable blocks (those to which a pointer was found) are not shown.

    Details:

    ==2004== 7,818 (192 direct, 7,626 indirect) bytes in 1 blocks are definitely lost in loss record 93 of 93
    ==2004== at 0x4C292C7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==2004== by 0x42FFF1: Glacier2::Blobject::Blobject(IceUtil::Handle<Glaci er2::Instance> const&, IceInternal::Handle<Ice::Connection> const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std:air<std::string const, std::string> > > const&) (in /usr/bin/glacier2router)
    ==2004== by 0x45DDCD: Glacier2::ServerBlobject::ServerBlobject(IceUtil:: Handle<Glacier2::Instance> const&, IceInternal::Handle<Ice::Connection> const&) (in /usr/bin/glacier2router)
    ==2004== by 0x450C2A: Glacier2::RouterI::RouterI(IceUtil::Handle<Glacier 2::Instance> const&, IceInternal::Handle<Ice::Connection> const&, std::string const&, IceInternal::ProxyHandle<IceProxy::Glacier2::Sessi on> const&, Ice::Identity const&, IceUtil::Handle<Glacier2::FilterManager> const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std:air<std::string const, std::string> > > const&) (in /usr/bin/glacier2router)
    ==2004== by 0x468106: Glacier2::CreateSession::sessionCreated(IceInterna l::ProxyHandle<IceProxy::Glacier2::Session> const&) (in /usr/bin/glacier2router)
    ==2004== by 0x4ECF82F: Glacier2::CallbackNC_SessionManager_create<Glacier 2::AMI_SessionManager_create>::__completed(IceInte rnal::Handle<Ice::AsyncResult> const&) const (in /usr/lib64/libGlacier2.so.3.4.2)
    ==2004== by 0x52CD42A: Ice::AsyncResult::__response() (in /usr/lib64/libIce.so.3.4.2)
    ==2004== by 0x52CD6ED: IceInternal::OutgoingAsync::__finished(IceInternal ::BasicStream&) (in /usr/lib64/libIce.so.3.4.2)
    ==2004== by 0x5239B55: Ice::ConnectionI::dispatch(IceUtil::Handle<Ice::Co nnectionI::StartCallback> const&, std::vector<IceInternal::Handle<IceInternal::Outgo ingAsyncMessageCallback>, std::allocator<IceInternal::Handle<IceInternal::Ou tgoingAsyncMessageCallback> > > const&, unsigned char, int, int, IceInternal::Handle<IceInternal::ServantManager> const&, IceInternal::Handle<Ice::ObjectAdapter> const&, IceInternal::Handle<IceInternal::OutgoingAsync> const&, IceInternal::BasicStream&) (in /usr/lib64/libIce.so.3.4.2)
    ==2004== by 0x523B1C4: Ice::ConnectionI::message(IceInternal::ThreadPoolC urrent&) (in /usr/lib64/libIce.so.3.4.2)
    ==2004== by 0x5352178: IceInternal::ThreadPool::run(IceUtil::Handle<IceUt il::Thread> const&) (in /usr/lib64/libIce.so.3.4.2)
    ==2004== by 0x5352A67: IceInternal::ThreadPool::EventHandlerThread::run() (in /usr/lib64/libIce.so.3.4.2)

    (Doing more iteration the number of lost blocks grow up linearly, stopping the client, glacier2router never release any memory.)
    Last edited by paolo; 01-25-2012 at 02:57 PM.

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    Thanks for reporting this, we'll look into it.

    Regards,
    Mark

  3. #3
    paolo is offline Registered User
    Name: paolo volpi
    Organization: tvblob
    Project: tvblob blobbox
    Join Date
    Aug 2007
    Posts
    22
    I done some more test and I found that with the previous Ice version (Ice 3.4.1) there are no leaks.
    I guess the problem is related to changes introduced in Glacier2/RequestQueue files
    Last edited by paolo; 01-26-2012 at 04:08 AM.

  4. #4
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    You are correct. I've posted a patch that fixes the leak.

    Thanks again,
    Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. a question about MFC memory leak in using ice
    By cnhome in forum Help Center
    Replies: 2
    Last Post: 06-08-2011, 10:17 PM
  2. Replies: 1
    Last Post: 05-21-2011, 09:12 AM
  3. Memory leak during ice initialisation
    By JvD in forum Help Center
    Replies: 3
    Last Post: 11-11-2009, 03:39 AM
  4. memory leak with Ice::IllegalIndirectionException
    By areslp in forum Help Center
    Replies: 2
    Last Post: 03-20-2009, 02:10 AM
  5. Memory leak when using ice with MFC?
    By _orchid_ in forum Help Center
    Replies: 9
    Last Post: 12-01-2003, 06:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •