Ice 3.1.1 core dump while invoke on replica

sinofoolsinofool Member Bochun BaiOrganization: sinofool.comProject: http://sinofool.com/ ✭✭
I am trying Ice-3.1.1 for another project on my own laptop running Ubuntu 6.10

A simple testing application works fine with 3.0.1 but core dump with 3.1.1
I am using g++ 4.1
*** glibc detected *** /opt/Ice-3.1/bin/icegridregistry: malloc(): memory corruption: 0x082f13c1 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb74661cd]
/lib/tls/i686/cmov/libc.so.6(malloc+0x7f)[0xb746783f]
/usr/lib/libstdc++.so.6(_Znwj+0x27)[0xb76174b7]
/opt/Ice-3.1/bin/icegridregistry[0x8172b0a]
/opt/Ice-3.1/bin/icegridregistry[0x8172d55]
/opt/Ice-3.1/bin/icegridregistry[0x8173163]
/opt/Ice-3.1/lib/libIce.so.31(_ZNK3Ice7Locator18___findAdapterByIdERN11IceInternal8IncomingERKNS_7CurrentE+0xb6)[0xb783e210]
/opt/Ice-3.1/lib/libIce.so.31(_ZN3Ice7Locator10__dispatchERN11IceInternal8IncomingERKNS_7CurrentE+0xab)[0xb783e7bd]
/opt/Ice-3.1/lib/libIce.so.31(_ZN11IceInternal8Incoming6invokeERKNS_6HandleINS_14ServantManagerEEE+0x76f)[0xb780df33]
/opt/Ice-3.1/lib/libIce.so.31(_ZN3Ice11ConnectionI9invokeAllERN11IceInternal11BasicStreamEiihRKNS1_6HandleINS1_14ServantManagerEEERKNS4_INS_13ObjectAdapterEEE+0x1be)[0xb77dd5fa]
/opt/Ice-3.1/lib/libIce.so.31(_ZN3Ice11ConnectionI7messageERN11IceInternal11BasicStreamERKNS1_6HandleINS1_10ThreadPoolEEE+0x1d2)[0xb77e3f44]
/opt/Ice-3.1/lib/libIce.so.31(_ZN11IceInternal10ThreadPool3runEv+0x1415)[0xb78ba221]
/opt/Ice-3.1/lib/libIce.so.31(_ZN11IceInternal10ThreadPool18EventHandlerThread3runEv+0x96)[0xb78baa9c]
/opt/Ice-3.1/lib/libIceUtil.so.31[0xb768df6d]
/lib/tls/i686/cmov/libpthread.so.0[0xb7649504]
/lib/tls/i686/cmov/libc.so.6(__clone+0x5e)[0xb74cc51e]
======= Memory map: ========
08048000-08248000 r-xp 00000000 03:02 889890     /opt/Ice-3.1.1/bin/icegridregistry
08248000-08253000 rw-p 00200000 03:02 889890     /opt/Ice-3.1.1/bin/icegridregistry
08253000-082ff000 rw-p 08253000 00:00 0          [heap]

This only happened when requests a replica group, but works fine with ordinary adapter.

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    What hardware are you using, and which processor?
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Could you also describe a bit more the circumstances under which the crash happens? What type of load balancing do you use for the replica group (None, Random, Round-robin, etc)? How do your clients invoke on the indirect proxy (often or rarely, using or not per-request load balancing)?

    If you can easily reproduce the crash, it would be great if you can send us a small test case. Seeing the strack trace with a debug build would also help to identify where the crash comes from.

    Cheers,
    Benoit.
  • sinofoolsinofool Member Bochun BaiOrganization: sinofool.comProject: http://sinofool.com/ ✭✭
    My processor is centrino 1.4G
    This crash happened both on Celeon 2.8G and Pentium4 2.8G with HT.
    These machines all run Ubuntu 6.10.

    I am using indirect proxy. Both round-robin and none type replica group crash. I have not tries random type.

    Here is my code:

    Slice:
    module MyTest
    {
    	class MyObj
    	{
    		string name;
    		string time;
    	};
    	interface MyServer
    	{
    		MyObj getResult();
    	};
    };
    

    Server side:
    MyServer.h
    #ifndef MYSERVER_H_
    #define MYSERVER_H_
    
    #include <Ice/Ice.h>
    #include <IceBox/IceBox.h>
    #include "MyTest.h"
    
    #if defined(_WIN32)
    #   define MY_API __declspec(dllexport)
    #else
    #   define MY_API /**/
    #endif
    
    extern "C" {
        MY_API IceBox::Service*
        create(Ice::CommunicatorPtr communicator);
    }
    
    namespace MyTest
    {
    
    class MY_API MyService : virtual public IceBox::Service
    {
    public:
    	virtual void start(const std::string& name, 
    		const Ice::CommunicatorPtr& ic, 
    		const Ice::StringSeq& args);
    	
    	virtual void stop();
    private:
    	Ice::ObjectAdapterPtr _adapter;
    };
    
    class MyServerI : virtual public MyServer
    {
    public:
    	MyServerI(const std::string&);
    	virtual MyObjPtr getResult(const Ice::Current& = Ice::Current());
    private:
    	std::string _name;
    };
    
    }
    #endif /*MYSERVER_H_*/
    
    MyServer.cpp
    #include "MyServer.h"
    #include <Ice/Ice.h>
    
    using namespace MyTest;
    using namespace std;
    
    extern "C" {
        MY_API IceBox::Service*
        create(Ice::CommunicatorPtr communicator)
        {
            return new MyService;
        }
    }
    
    MyServerI::MyServerI(const std::string& name)
    	: _name(name)
    {
    };
    	
    MyTest::MyObjPtr MyServerI::getResult(const Ice::Current&)
    {
    	MyObjPtr obj = new MyObj;
    	obj->name = _name;
    	obj->time = "";
    	return obj;
    }
    
    
    void MyService::start(
    const ::std::string& name, 
    const ::Ice::CommunicatorPtr& ic, 
    const ::Ice::StringSeq& args)
    {
    	_adapter = ic->createObjectAdapter(name);
    	Ice::ObjectPtr object = new MyServerI(name);
    	_adapter->add(
    		object, ic->stringToIdentity("Manager")
    		);
    	_adapter->activate();
    }
    
    void MyService::stop()
    {
    	_adapter->deactivate();
    }
    

    MyClient.cpp
    #include <Ice/Ice.h>
    #include "MyTest.h"
    #include <iostream>
    
    using namespace MyTest;
    using namespace std;
    
    int main(int argc, char* argv[])
    {
    cout << "init." << endl;
    	Ice::PropertiesPtr props = Ice::createProperties();
    	props->setProperty("Ice.Default.Locator", "bbc/Locator:tcp -h 127.0.0.1 -p 10000");
    	Ice::InitializationData init;
    	init.properties=props;
    	Ice::CommunicatorPtr ic = Ice::initialize(init);
    	
    	cout << "create proxy" << endl;
    	
    	Ice::ObjectPrx proxy = ic->stringToProxy("[email protected]");
    	
    	cout << "cast" << endl;
    	
    	MyServerPrx obj = MyServerPrx::checkedCast(proxy);
    
    	cout << "get" << endl;
    	int i = 5;
    	while(i-- > 0)
    	{
    	MyObjPtr aaa = obj->getResult();
    	std::cout << aaa->name << " " << std::endl;
    	sleep(1);
    	}
    //	cout << proxy->ice_getAdapterId();
    	
    	return 0;
    }
    
    

    app.xml
    <icegrid>
    	<application name="app">
    		<server-template id="MyServer">
    			<parameter name="Index" />
    			<icebox id="MyServer${Index}" exe="/opt/Ice-3.1/bin/icebox" activation="on-demand">
    				<service name="MyServer${Index}" entry="MyServer:create">
    					<adapter name="MyServer${Index}" endpoints="tcp" replica-group="ReplicatedServer"/>
    				</service>
    			</icebox>
    		</server-template>
    		<replica-group id="ReplicatedServer">
    			<load-balancing type="round-robin" n-replicas="3"/>
    		</replica-group>
    
    		<node name="node1">
    			<server-instance template="MyServer" Index="1" />
    		</node>
    
    		<node name="node2">
    			<server-instance template="MyServer" Index="2" />
    		</node>
    
    		<node name="node3">
    			<server-instance template="MyServer" Index="3" />
    		</node>
    	</application>
    </icegrid>
    

    I run this client program like this:
    for i in 1 2 3 4 5; 
    do 
    for m in 1 2 3 4 5;
    do 
    LD_LIBRARY_PATH=/opt/Ice-3.1/lib ./MyClient & 
    done;
    done
    
    If I use [email protected]apter it works fine. But the code shows above crash every time.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Thanks, I'll try to reproduce it with your code.

    Btw, did you build Ice yourself or did you use a Linux binary package (the RPM or tar.gz?)? Did you try with a debug build to see if it also abort?

    Cheers,
    Benoit.
  • sinofoolsinofool Member Bochun BaiOrganization: sinofool.comProject: http://sinofool.com/ ✭✭
    I build ice 3.1.1 from source. I have tried to rebuild with gcc 3.3 but crash again.
    How to build a debug version? Does it mean build without optimize=yes?
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    You must use OPTIMIZE=no (or not set it at all) for a debug build. In any case, I think Benoit was already able to reproduce the problem, and is currently investigating.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    I've posted a patch that should fix this problem [thread=2745]here[/thread]. Thanks for the sample code and instructions on how to reproduce this problem!

    Cheers,
    Benoit.
  • sinofoolsinofool Member Bochun BaiOrganization: sinofool.comProject: http://sinofool.com/ ✭✭
    It works!!
    Thank you!!
Sign In or Register to comment.