Archived

This forum has been archived. Please start a new discussion on GitHub.

BasicStream.cpp:581 Assertion

xdm
xdm La Coruña, Spain
I get the next assertion in a c++ program, what this mean?
icebox: BasicStream.cpp:581: void IceInternal::BasicStream::writeSize(int): Assertion `v >= 0' failed.

Here is the code that's assert
Oz::MetaService::MetaObjectManagerPrx
Oz::MetaService::MetaServerManagerI::createMetaObject(
	const std::string& type,
	const Oz::Base::StringMap& attributes,
	const Ice::Current& current)
{
	std::cout<<"createMetaObject"<<std::endl;
	MetaObjectManagerPrx metaObjectManagerPx=0;
	try
	{
		MetaObjectPrx metaObjectPx = metaServer->createMetaObject(type,attributes);
		metaObjectManagerPx = internal_getMetaObjectManager(metaObjectPx,current);
		std::cout<<"metaObjectMagerPx: "<<metaObjectManagerPx<<std::endl;
	}
	catch(const Ice::Exception& e)
	{
		std::cout<<e<<std::endl;
	}
	std::cout<<"createMetaObject END"<<std::endl;
	return metaObjectManagerPx;
}

Oz::MetaService::MetaObjectManagerPrx
Oz::MetaService::MetaServerManagerI::internal_getMetaObjectManager(
	const Oz::MetaService::MetaObjectPrx& metaObjectPx,
	const Ice::Current& current)
{
	MetaObjectManagerPrx metaObjectManagerPx = 0;
	std::cout<<"MetaServerManagerI::internal_getMetaObjectManager"<<std::endl;
	
	if(metaObjectPx != 0)
	{
		try
		{
			Ice::Identity metaObjectId = metaObjectPx->getId();
			
			MetaObjectManagerMap::const_iterator it;
			it = metaObjectManagers.find(metaObjectId);
			if(it == metaObjectManagers.end())
			{
				std::cout<<"MetaObjectManager not Exist"<<std::endl;
				Ice::Identity managerId;
				managerId.name = IceUtil::generateUUID();
				managerId.category = id.category;

				MetaObjectManagerPtr metaObjectManagerPt = new MetaObjectManagerI(
					managerId,
					sessionPx,
					sessionId,
					metaObjectPx);
	
				metaObjectManagerPx = MetaObjectManagerPrx::uncheckedCast(
					current.adapter->add(metaObjectManagerPt,managerId));
	
				metaObjectManagers[metaObjectId]=metaObjectManagerPx;
				std::cout<<"MetaObjectManger created OK"<<std::endl;
			}
			else
			{
				metaObjectManagerPx = (*it).second;
				std::cout<<"MetaObjectManager exist"<<std::endl;
			}
		}
		catch(const Ice::Exception& e)
		{
			std::cout<<e<<std::endl;
		}
	}
	std::cout<<"MetaServerManagerI::internal_getMetaObjectManager END"<<std::endl;
	return metaObjectManagerPx;
}

Program oput
MetaServerManagerI::getMetaObjectManager
MetaServerManagerI::internal_getMetaObjectManager
MetaObjectManager not Exist
MetaObjectManger created OK
MetaServerManagerI::internal_getMetaObjectManager END
icebox: BasicStream.cpp:581: void IceInternal::BasicStream::writeSize(int): Assertion `v >= 0' failed.
[ icegridnode: Activator: detected termination of server `MetaServiceManager'
  signal = SIGABRT ]

Any ideas what is the trouble?

thanks in advance

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    Hi,

    Could you post the stack trace from when your application asserted?

    Regards,
    Dwayne
  • xdm
    xdm La Coruña, Spain
    I don't know how attach gdb to icebox to show it, if you explain me how i can do it

    thanks for quick reply
  • marc
    marc Florida
    You just run gdb, then use "attach <pid>", with <pid> being the process ID of icebox. Continue execution, and reproduce the crash. Use the "bt" command to get the stack trace. For more information, please refer to the gdb documentation.
  • xdm
    xdm La Coruña, Spain
    If i attach gdb to icebox, A deadlock occurs and i can see the previous crash
  • marc
    marc Florida
    What's the stack trace for the deadlock? And if you see the previous crash, what's the stack trace for this previous crash? Perhaps it would help if you cut&paste your GDB session.
  • xdm
    xdm La Coruña, Spain
    When i attach gdb to icebox process i only can see this and the service is deadlock, i don't see the previous crash.

    if i type run inside gdb, the program runs with out dead lock and crash occurs again, but when the crash occurs icebox is still runnig in gdb and i need to type Control C to be able of run other command the second ouput show this, but i think the stack that it shows is related to Control C and not to the icebox crash
    pepone@localhost /opt/src/Ice-3.0.1 $ gdb - 12077
    GNU gdb 6.4
    Copyright 2005 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i686-pc-linux-gnu"...-: No such file or directory.
    
    Attaching to process 12077
    
    warning: Could not load vsyscall page because no executable was specified
    try using the "file" command first.
    Reading symbols from /opt/Ice-3.0.1/bin/icebox...done.
    Using host libthread_db library "/lib/libthread_db.so.1".
    Reading symbols from /opt/Ice-3.0.1/lib/libIceBox.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libIceBox.so.30
    Reading symbols from /opt/Ice-3.0.1/lib/libIce.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libIce.so.30
    Reading symbols from /opt/Ice-3.0.1/lib/libIceUtil.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libIceUtil.so.30
    Reading symbols from /lib/libpthread.so.0...done.
    [Thread debugging using libthread_db enabled]
    [New Thread -1213339984 (LWP 12077)]
    [New Thread -2039583824 (LWP 12084)]
    [New Thread -1905362000 (LWP 12083)]
    [New Thread -1771140176 (LWP 12082)]
    [New Thread -1636918352 (LWP 12081)]
    [New Thread -1502696528 (LWP 12080)]
    [New Thread -1347564624 (LWP 12079)]
    [New Thread -1213342800 (LWP 12078)]
    Loaded symbols for /lib/libpthread.so.0
    Reading symbols from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.so.5...done.
    Loaded symbols for /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.so.5
    Reading symbols from /lib/libm.so.6...done.
    Loaded symbols for /lib/libm.so.6
    Reading symbols from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libgcc_s.so.1...done.
    Loaded symbols for /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libgcc_s.so.1
    Reading symbols from /lib/libc.so.6...done.
    Loaded symbols for /lib/libc.so.6
    Reading symbols from /lib/libbz2.so.1...done.
    Loaded symbols for /lib/libbz2.so.1
    Reading symbols from /lib/libdl.so.2...done.
    Loaded symbols for /lib/libdl.so.2
    Reading symbols from /lib/ld-linux.so.2...done.
    Loaded symbols for /lib/ld-linux.so.2
    Reading symbols from /home/pepone/hydra/lib/libMetaManager.so...done.
    Loaded symbols for /home/pepone/hydra/lib/libMetaManager.so
    Reading symbols from /opt/Ice-3.0.1/lib/libFreeze.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libFreeze.so.30
    Reading symbols from /opt/db/lib/libdb_cxx-4.3.so...done.
    Loaded symbols for /opt/db/lib/libdb_cxx-4.3.so
    Reading symbols from /opt/Ice-3.0.1/lib/libIceXML.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libIceXML.so.30
    Reading symbols from /lib/libuuid.so.1...done.
    Loaded symbols for /lib/libuuid.so.1
    Reading symbols from /usr/qt/3/lib/libqt-mt.so.3...done.
    Loaded symbols for /usr/qt/3/lib/libqt-mt.so.3
    Reading symbols from /opt/Ice-3.0.1/lib/libIceStorm.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libIceStorm.so.30
    Reading symbols from /home/pepone/hydra/lib/libSearchs.so.1...done.
    Loaded symbols for /home/pepone/hydra/lib/libSearchs.so.1
    Reading symbols from /home/pepone/hydra/lib/libOnRez.so.1...done.
    Loaded symbols for /home/pepone/hydra/lib/libOnRez.so.1
    Reading symbols from /home/pepone/hydra/lib/libDomains.so.1...done.
    Loaded symbols for /home/pepone/hydra/lib/libDomains.so.1
    Reading symbols from /home/pepone/hydra/lib/libMetaService.so.1...done.
    Loaded symbols for /home/pepone/hydra/lib/libMetaService.so.1
    Reading symbols from /home/pepone/hydra/lib/libOnRezManager.so.1...done.
    Loaded symbols for /home/pepone/hydra/lib/libOnRezManager.so.1
    Reading symbols from /usr/lib/libXext.so.6...done.
    Loaded symbols for /usr/lib/libXext.so.6
    Reading symbols from /usr/lib/libX11.so.6...done.
    Loaded symbols for /usr/lib/libX11.so.6
    Reading symbols from /usr/lib/libexpat.so.0...done.
    Loaded symbols for /usr/lib/libexpat.so.0
    Reading symbols from /usr/lib/libaudio.so.2...done.
    Loaded symbols for /usr/lib/libaudio.so.2
    Reading symbols from /usr/lib/libXt.so.6...done.
    Loaded symbols for /usr/lib/libXt.so.6
    Reading symbols from /usr/lib/libmng.so.1...done.
    Loaded symbols for /usr/lib/libmng.so.1
    Reading symbols from /usr/lib/libjpeg.so.62...done.
    Loaded symbols for /usr/lib/libjpeg.so.62
    Reading symbols from /usr/lib/libpng.so.3...done.
    Loaded symbols for /usr/lib/libpng.so.3
    Reading symbols from /lib/libz.so.1...done.
    Loaded symbols for /lib/libz.so.1
    Reading symbols from /usr/lib/libXi.so.6...done.
    Loaded symbols for /usr/lib/libXi.so.6
    Reading symbols from /usr/lib/libXrender.so.1...done.
    Loaded symbols for /usr/lib/libXrender.so.1
    Reading symbols from /usr/lib/libXrandr.so.2...done.
    Loaded symbols for /usr/lib/libXrandr.so.2
    Reading symbols from /usr/lib/libXcursor.so.1...done.
    Loaded symbols for /usr/lib/libXcursor.so.1
    Reading symbols from /usr/lib/libXinerama.so.1...done.
    Loaded symbols for /usr/lib/libXinerama.so.1
    Reading symbols from /usr/lib/libXft.so.2...done.
    Loaded symbols for /usr/lib/libXft.so.2
    Reading symbols from /usr/lib/libfreetype.so.6...done.
    Loaded symbols for /usr/lib/libfreetype.so.6
    Reading symbols from /usr/lib/libfontconfig.so.1...done.
    Loaded symbols for /usr/lib/libfontconfig.so.1
    Reading symbols from /usr/lib/libSM.so.6...done.
    Loaded symbols for /usr/lib/libSM.so.6
    Reading symbols from /usr/lib/libICE.so.6...done.
    Loaded symbols for /usr/lib/libICE.so.6
    Reading symbols from /opt/Ice-3.0.1/lib/libIceGrid.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libIceGrid.so.30
    Reading symbols from /home/pepone/hydra/lib/libFiles.so.1...done.
    Loaded symbols for /home/pepone/hydra/lib/libFiles.so.1
    Reading symbols from /usr/lib/libXau.so.6...done.
    Loaded symbols for /usr/lib/libXau.so.6
    Reading symbols from /usr/lib/liblcms.so.1...done.
    Loaded symbols for /usr/lib/liblcms.so.1
    Reading symbols from /opt/Ice-3.0.1/lib/libGlacier2.so.30...done.
    Loaded symbols for /opt/Ice-3.0.1/lib/libGlacier2.so.30
    0xffffe410 in ?? ()
    (gdb) bt
    #0  0xffffe410 in ?? ()
    #1  0xbfbe23e8 in ?? ()
    #2  0x00000001 in ?? ()
    #3  0x00000000 in ?? ()
    
    

    (gdb) run
    Starting program: /opt/Ice-3.0.1/bin/icebox
    [Thread debugging using libthread_db enabled]
    [New Thread -1214220624 (LWP 12145)]
    [New Thread -1214223440 (LWP 12146)]
    [New Thread -1348445264 (LWP 12147)]
    
    
    
    [Thread -1348445264 (LWP 12147) exited]
    
    Program received signal SIG32, Real-time event 32.
    [Switching to Thread -1214223440 (LWP 12146)]
    0xffffe410 in __kernel_vsyscall ()
    (gdb) bt
    #0  0xffffe410 in __kernel_vsyscall ()
    #1  0xb7c19221 in do_sigwait () from /lib/libpthread.so.0
    #2  0xb7c192a7 in sigwait () from /lib/libpthread.so.0
    #3  0xb7c5a64f in sigwaitThread () at CtrlCHandler.cpp:124
    #4  0xb7c13aba in start_thread () from /lib/libpthread.so.0
    #5  0xb7acf35e in clone () from /lib/libc.so.6
    (gdb)                                                     
    
  • marc
    marc Florida
    Once you have attached to icebox, use "cont" to continue. Then reproduce the crash. Then get the stack trace of the assert.
  • xdm
    xdm La Coruña, Spain
    Thanks Marc

    here is the stack trace
    (gdb) cont
    Continuing.
    
    Program received signal SIGABRT, Aborted.
    [Switching to Thread -1771308112 (LWP 12695)]
    0xffffe410 in ?? ()
    (gdb) bt
    #0  0xffffe410 in ?? ()
    #1  0x966be5c8 in ?? ()
    #2  0x00000006 in ?? ()
    #3  0x00003197 in ?? ()
    #4  0xb7af1b59 in raise () from /lib/libc.so.6
    #5  0xb7af31d1 in abort () from /lib/libc.so.6
    #6  0xb7aeb621 in __assert_fail () from /lib/libc.so.6
    #7  0xb7e2212e in IceInternal::BasicStream::writeSize (this=0x966bec18, v=-1771313228) at BasicStream.cpp:581
    #8  0xa703785c in Oz::Base::__write (__os=0x966bec18, v=@0x966be7a0) at SysTypes.cpp:160
    #9  0xa7a64a8f in Oz::MetaService::MetaObjectManagerAdmin::___getAttributes (this=0x8087530, __inS=@0x966bebe0,
        __current=@0x966bebe0) at MetaObjectManager.cpp:993
    #10 0xa7a65856 in Oz::MetaService::MetaObjectManager::__dispatch (this=0x8087530, in=@0x966bebe0, current=@0x966bebe0)
        at MetaObjectManager.cpp:1276
    #11 0xb7e7e070 in IceInternal::Incoming::invoke (this=0x966bebe0, servantManager=@0x966bedb0) at Incoming.cpp:173
    #12 0xb7e5874f in Ice::ConnectionI::invokeAll (this=0x808a8f8, stream=@0x966beee0, invokeNum=1, requestId=4,
        compress=0 '\0', servantManager=@0x966bedb0, adapter=@0x966beda0) at ConnectionI.cpp:2244
    #13 0xb7e5202f in Ice::ConnectionI::message (this=0x808a8f8, stream=@0x966beee0, threadPool=@0x966bf250)
        at ConnectionI.cpp:1284
    #14 0xb7f18b83 in IceInternal::ThreadPool::run (this=0x8089120) at ThreadPool.cpp:639
    #15 0xb7f19bf8 in IceInternal::ThreadPool::EventHandlerThread::run (this=0x80876c8) at ThreadPool.cpp:853
    #16 0xb7d1ef08 in startHook (arg=0x80876c8) at Thread.cpp:482
    #17 0xb7cc1aba in start_thread () from /lib/libpthread.so.0
    #18 0xb7b7d35e in clone () from /lib/libc.so.6
    (gdb) 
    
  • marc
    marc Florida
    According to the stack trace, the problem is with one of the values returned by getAttributes. What is the signature of this operation, what does it return? Can you put print statements into your code to verify that the returned values are correct?
  • xdm
    xdm La Coruña, Spain
    Thanks Marc problem was a missing return value in a non void function, but print statetems make me miss the point, thanks again for all