[omniORB] *** glibc detected *** ./client_corba: munmap_chunk(): invalid pointer: 0x0804d620 *** when running ECHO example!

Carlos carlos at canama.net
Mon Feb 19 20:52:51 GMT 2007


El mar, 20-02-2007 a las 01:06 +0700, LQV0604 lqv escribió:
> I running the example "Echo" but there are errors occured. Here is my
> trace log.
> Could you please help me to solve the problems? 
> Any help will be greatly appreciate!
> 
> Thanks and Best regards,
> 
> Running:
> $./echo
> 
> CODE
> 
> #include <iostream>
> #include "echo.hh"
> using namespace std;
> 
> class Echo_i : public POA_Echo{
> public:
>     inline Echo_i(){}; 
>     inline ~Echo_i(){};
>     virtual char* echoString(const char* mesg);
> };
> 
> char * Echo_i::echoString(const char* mesg){
Here is the problem:
>     return "Hello world";

you must return CORBA::string_dup("Hello world");

Because the server part of ORB try to delete the pointer returned by
Echo_i::echoString() after putting the message in the "wire".

Cheers.

Carlos.

> };
> static void hello(Echo_ptr e)
> {
>   if( CORBA::is_nil(e) ) {
>     cerr << "hello: The object reference is nil!\n" << endl;
>     return;
>   }
>   CORBA::String_var src = (const char*) "Hello!";
>   // String literals are (char*) rather than (const char*) on some 
>   // old compilers. Thus it is essential to cast to (const char*)
>   // here to ensure that the string is copied, so that the
>   // CORBA::String_var does not attempt to \u2019delete\u2019 the
> string
>   // literal. 
>   CORBA::String_var dest = e->echoString(src);
>   cout << "I said, \"" << (char*)src << "\"." << endl
>        << "The Echo object replied, \"" << (char*)dest <<"\"." <<
> endl; 
> };
> 
> 
> int main(int argc, char *argv[]){
>     try {
>   // Initialise the ORB.
>   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
>   // Obtain a reference to the root POA.
>   //CORBA::Object_var obj =
> orb->resolve_initial_references("RootPOA"); 
>   CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
>   PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
>     // We allocate the object on the heap. Since this is a reference 
>     // counted object, it will be deleted by the POA when it is no
>     // longer needed.
>   Echo_i* myecho = new Echo_i();
>   // Activate the object. This tells the POA that this object is
>   // ready to accept requests. 
>   PortableServer::ObjectId_var myechoid =
> poa->activate_object(myecho);
>     // Obtain a reference to the object.
>   Echo_var myechoref = myecho->_this();
>   // Decrement the reference count of the object implementation, so 
>   // that it will be properly cleaned up when the POA has determined
>   // that it is no longer needed.
>   myecho->_remove_ref();
>   // Obtain a POAManager, and tell the POA to start accepting
>   // requests on its objects. 
>   PortableServer::POAManager_var pman = poa->the_POAManager();
>   pman->activate();
>   // Do the client-side call.
>   hello(myechoref);
>   // Clean up all the resources.
>   orb->destroy();
> }
>     catch(CORBA::SystemException& ex) { 
>           cerr << "Caught CORBA::" << ex._name() << endl;
>     }
>     catch(CORBA::Exception& ex) {
>           cerr << "Caught CORBA::Exception: " << ex._name() << endl; 
>     }
>     catch(omniORB::fatalException& fe) {
>           cerr << "Caught omniORB::fatalException:" << endl;
>           cerr << " file: " << fe.file() << endl; 
>           cerr << " line: " << fe.line() << endl;
>           cerr << " mesg: " << fe.errmsg() << endl;
>     }
>     cout << "Hello world";
>     return 0;
> };
> 
> TRACE LOG
> omniORB: (0) 2007-02-19 23:30:21.586723: Distribution date: Tue Nov 28
> 13:27:23 GMT 2006 dgrisby
> omniORB: (0) 2007-02-19 23:30:21.587388: My addresses are: 
> omniORB: 127.0.0.1
> omniORB: 192.168.1.5
> omniORB: ::1
> omniORB: (0) 2007-02-19 23:30:21.587681: Maximum supported GIOP
> version is 1.2
> omniORB: (0) 2007-02-19 23:30: 21.587922: Native char code sets:
> ISO-8859-1 UTF-8.
> omniORB: (0) 2007-02-19 23:30:21.588065: Transmission char code sets:
> ISO-8859-1(1.2) ISO-8859-1(1.1) ISO-8859-1(1.0) UTF-8(1.2) UTF-8(1.1).
> omniORB: (0) 2007-02-19 23:30: 21.588175: Native wide char code sets:
> UTF-16.
> omniORB: (0) 2007-02-19 23:30:21.588296: Transmission wide char code
> sets: UTF-16(1.2).
> omniORB: (0) 2007-02-19 23:30:21.588438: Information: the omniDynamic
> library is not linked. 
> omniORB: (0) 2007-02-19 23:30:21.588807: Current configuration is as
> follows:
> omniORB:   DefaultInitRef (file) = 
> omniORB:   DefaultInitRef (args) = 
> omniORB:   InitRef =
> NameService=IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e300000010000000000000060000000010102000c0000003139322e3136382e312e3500f90a00000b0000004e616d6553657276696365000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100 
> omniORB:   abortOnInternalError = 0
> omniORB:   abortOnNativeException = 0
> omniORB:   acceptBiDirectionalGIOP = 0
> omniORB:   acceptMisalignedTcIndirections = 0
> omniORB:   bootstrapAgentHostname = 
> omniORB:   bootstrapAgentPort = 900 
> omniORB:   clientCallTimeOutPeriod = 0
> omniORB:   clientConnectTimeOutPeriod = 0
> omniORB:   clientTransportRule = * unix,ssl,tcp
> omniORB:   configFile = /etc/omniORB.cfg
> omniORB:   connectionWatchImmediate = 0 
> omniORB:   connectionWatchPeriod = 50000
> omniORB:   copyValuesInLocalCalls = 1
> omniORB:   diiThrowsSysExceptions = 0
> omniORB:   dumpConfiguration = 1
> omniORB:   endPoint = giop:tcp::
> omniORB:   endPointPublish = addr 
> omniORB:   giopMaxMsgSize = 2097152
> omniORB:   giopTargetAddressMode = KeyAddr
> omniORB:   id = omniORB4
> omniORB:   idleThreadTimeout = 10
> omniORB:   inConScanPeriod = 180
> omniORB:   lcdMode = 0
> omniORB:   maxGIOPConnectionPerServer = 5 
> omniORB:   maxGIOPVersion = 1.2
> omniORB:   maxInterleavedCallsPerConnection = 5
> omniORB:   maxServerThreadPerConnection = 100
> omniORB:   maxServerThreadPoolSize = 100
> omniORB:   maxSocketRecv = 2147483647
> omniORB:   maxSocketSend = 2147483647
> omniORB:   nativeCharCodeSet = ISO-8859-1
> omniORB:   nativeWCharCodeSet = UTF-16
> omniORB:   objectTableSize = 0
> omniORB:   offerBiDirectionalGIOP = 0
> omniORB:   oneCallPerConnection = 1 
> omniORB:   outConScanPeriod = 120
> omniORB:   poaHoldRequestTimeout = 0
> omniORB:   poaUniquePersistentSystemIds = 1
> omniORB:   principal = [Null]
> omniORB:   scanGranularity = 5
> omniORB:   serverCallTimeOutPeriod = 0 
> omniORB:   serverTransportRule = * unix,ssl,tcp
> omniORB:   strictIIOP = 1
> omniORB:   supportBootstrapAgent = 0
> omniORB:   supportCurrent = 1
> omniORB:   supportPerThreadTimeOut = 0
> omniORB:   tcAliasExpand = 0 
> omniORB:   threadPerConnectionLowerLimit = 9000
> omniORB:   threadPerConnectionPolicy = 1
> omniORB:   threadPerConnectionUpperLimit = 10000
> omniORB:   threadPoolWatchConnection = 1
> omniORB:   traceExceptions = 1 
> omniORB:   traceFile = [stderr]
> omniORB:   traceInvocationReturns = 1
> omniORB:   traceInvocations = 1
> omniORB:   traceLevel = 40
> omniORB:   traceThreadId = 1
> omniORB:   traceTime = 1
> omniORB:   unixTransportDirectory = /tmp/omni-%u 
> omniORB:   unixTransportPermission =  777
> omniORB:   useTypeCodeIndirections = 1
> omniORB:   verifyObjectExistsAndType = 1
> omniORB: (0) 2007-02-19 23:30:21.589361: Initialising incoming
> endpoints.
> omniORB: (0) 2007-02-19 23:30: 21.589529: Instantiate endpoint
> 'giop:tcp::0'
> omniORB: (0) 2007-02-19 23:30:21.590103: Bind to address ::
> omniORB: (0) 2007-02-19 23:30:21.590471: Publish specification: 'addr'
> omniORB: (0) 2007-02-19 23:30: 21.590665: Try to publish 'addr' for
> endpoint giop:tcp:192.168.1.5:44206
> omniORB: (0) 2007-02-19 23:30:21.590812: Publish endpoint
> 'giop:tcp:192.168.1.5:44206'
> omniORB: (0) 2007-02-19 23:30:21.591034: Starting serving incoming
> endpoints.
> omniORB: (0) 2007-02-19 23:30:21.591384: Adding root<0> (activating)
> to object table.
> omniORB: (0) 2007-02-19 23:30: 21.591592: State root<0> (activating)
> -> active
> omniORB: (0) 2007-02-19 23:30:21.591820: Creating ref to local:
> root<0>
>  target id      : IDL:Echo:1.0
>  most derived id: IDL:Echo:1.0
> omniORB: (0) 2007-02-19 23:30:21.592057: Dispatching local call
> 'echoString' to root<0> (active)
> omniORB: (0) 2007-02-19 23:30: 21.592227: Return from local call
> 'echoString' to root<0> (active)
> *** glibc detected *** ./echo: munmap_chunk(): invalid pointer:
> 0x0804d620 ***
> ======= Backtrace: =========
> /lib/libc.so.6(cfree+0x1bb)[0x4930a67b]
> /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x41a6fef1]
> /usr/lib/libstdc++.so.6(_ZdaPv+0x1d)[0x41a6ff4d]
> ./echo[0x804b9a6]
> ./echo[0x804b9c0] 
> ./echo[0x804c06e]
> ./echo[0x804c287]
> /lib/libc.so.6(__libc_start_main+0xdc)[0x492b6f2c]
> ./echo(__gxx_personality_v0+0x85)[0x804a1c1]
> ======= Memory map: ========
> 0063a000-007a8000 r-xp 00000000 fd:00
> 190170     /usr/local/lib/libomniORB4.so.1.0 
> 007a8000-007b5000 rwxp 0016e000 fd:00
> 190170     /usr/local/lib/libomniORB4.so.1.0
> 007b5000-007b6000 rwxp 007b5000 00:00 0 
> 00a5a000-00a5b000 r-xp 00a5a000 00:00 0          [vdso]
> 00ff8000-00ffd000 r-xp 00000000 fd:00
> 190166     /usr/local/lib/libomnithread.so.3.3 
> 00ffd000-00ffe000 rwxp 00004000 fd:00
> 190166     /usr/local/lib/libomnithread.so.3.3
> 08048000-0804f000 r-xp 00000000 fd:00
> 1201850    /root/workspace/echo/Debug/echo
> 0804f000-08050000 rwxp 00006000 fd:00
> 1201850    /root/workspace/echo/Debug/echo 
> 08789000-087aa000 rwxp 08789000 00:00 0 
> 419ae000-419b9000 r-xp 00000000 fd:00
> 2076850    /lib/libgcc_s-4.1.1-20070105.so.1
> 419b9000-419ba000 rwxp 0000a000 fd:00
> 2076850    /lib/libgcc_s-4.1.1-20070105.so.1
> 419bc000-41a9c000 r-xp 00000000 fd:00 168053     /usr/lib/libstdc
> ++.so.6.0.8 
> 41a9c000-41a9f000 r-xp 000e0000 fd:00 168053     /usr/lib/libstdc
> ++.so.6.0.8
> 41a9f000-41aa1000 rwxp 000e3000 fd:00 168053     /usr/lib/libstdc
> ++.so.6.0.8
> 41aa1000-41aa7000 rwxp 41aa1000 00:00 0 
> 488d2000-488eb000 r-xp 00000000 fd:00 2078731    /lib/ld- 2.5.so
> 488eb000-488ec000 r-xp 00018000 fd:00 2078731    /lib/ld-2.5.so
> 488ec000-488ed000 rwxp 00019000 fd:00 2078731    /lib/ld-2.5.so 
> 492a1000-493d8000 r-xp 00000000 fd:00 2078732    /lib/libc-2.5.so
> 493d8000-493da000 r-xp 00137000 fd:00 2078732    /lib/libc-2.5.so
> 493da000-493db000 rwxp 00139000 fd:00 2078732    /lib/libc- 2.5.so
> 493db000-493de000 rwxp 493db000 00:00 0 
> 493e0000-49405000 r-xp 00000000 fd:00 2078739    /lib/libm-2.5.so
> 49405000-49406000 r-xp 00024000 fd:00 2078739    /lib/libm- 2.5.so
> 49406000-49407000 rwxp 00025000 fd:00 2078739    /lib/libm-2.5.so
> 4940f000-49422000 r-xp 00000000 fd:00
> 2078734    /lib/libpthread-2.5.so
> 49422000-49423000 r-xp 00012000 fd:00
> 2078734    /lib/libpthread-2.5.so
> 49423000-49424000 rwxp 00013000 fd:00
> 2078734    /lib/libpthread-2.5.so
> 49424000-49426000 rwxp 49424000 00:00 0 
> b75b4000-b75b5000 ---p b75b4000 00:00 0 
> b75b5000-b7fb7000 rw-p b75b5000 00:00 0 
> b7fc6000-b7fc8000 rw-p b7fc6000 00:00 0 
> bfad7000-bfaec000 rw-p bfad7000 00:00 0          [stack]
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list




More information about the omniORB-list mailing list