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