Reputation: 111
I'm attempting to wrap my head around omniORB in preparation for using it to interface with a piece of software we'll be getting that uses CORBA. The strategy I'm using is to take an example in omniORB (the echo example, specifically eg3_impl and eg3_cc) and blend in the idl from the received software until it does what I want. In service of that, I'm trying to isolate the software I'm writing from the rest of the omniORB stack (i.e. I'm trying to write an independent makefile that will depend on compiled libraries). I'm using omniORB-4.2.3, downloaded from sourceforge (via omniORB-support.com link).
The problem I'm hitting is, the example compiled from the independent makefile appears to have memory issues that the compiled-in-tree example doesn't have;
the source files are the same between the two examples; the only difference is, the non-independent example uses the makefile structure built into the omniORB tree, and the independent software uses a compile script that I wrote, based on what I observed the makefile structure doing when it built the echo example.
here's my script:
WHICH_BUILD_DIR=build2
WHICH_VERSION=omniORB-4.2.3
INCLUDE_G_PLUS_PLUS="-I./idl_artifacts/ -I../${WHICH_VERSION}/include -I. -I../${WHICH_VERSION}/${WHICH_BUILD_DIR}/include"
DEFINES_G_PLUS_PLUS="-D__OMNIORB4__ -D_REENTRANT -D__OSVERSION__=2 -D__linux__ -D__x86__"
LIBRARY_G_PLUS_PLUS="-L../${WHICH_VERSION}/${WHICH_BUILD_DIR}/lib -L/usr/lib"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/jasont/FACE_translator/omniORB-4.2.3/build2/lib
reset
if [ "~$1" == "~debug" ] ; then DEBUGGER_OPTION="-g"
else DEBUGGER_OPTION="" ; fi
rm -rf ./idl_artifacts *.o eg3_impl eg3_clt eg3_tieimpl
mkdir idl_artifacts
#compile idl file to skeleton files
../${WHICH_VERSION}/${WHICH_BUILD_DIR}/bin/omniidl -bcxx -Wba -Wbtp -C./idl_artifacts/ echo.idl
#regular compile
g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFINES_G_PLUS_PLUS -o echoSK.o ./idl_artifacts/echoSK.cc
g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFINES_G_PLUS_PLUS -o eg3_impl.o eg3_impl.cc
# g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFINES_G_PLUS_PLUS -o eg3_tieimpl.o eg3_tieimpl.cc
g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFINES_G_PLUS_PLUS -o eg3_clt.o eg3_clt.cc
#regular link
# g++ -o eg3_impl -O2 -Wall -Wno-unused -fexceptions eg3_impl.o echoSK.o $LIBRARY_G_PLUS_PLUS -lomniORB4 -lomnithread -lpthread
##g++ -o eg3_tieimpl -O2 -Wall -Wno-unused -fexceptions eg3_tieimpl.o echoSK.o $LIBRARY_G_PLUS_PLUS -lomniORB4 -lomnithread -lpthread
# g++ -o eg3_clt -O2 -Wall -Wno-unused -fexceptions eg3_clt.o echoSK.o $LIBRARY_G_PLUS_PLUS -lomniORB4 -lomnithread -lpthread
g++ -o eg3_impl -O2 -Wall -Wno-unused -fexceptions eg3_impl.o echoSK.o $LIBRARY_G_PLUS_PLUS -static -lomniORB4 -lomnithread -lpthread
./eg3_impl
...here's what I'm seeing my the independent software do (generated by setting the omniORB.cfg tracelevel to maximum)
...
omniORB: (0) 2020-11-06 12:50:37.443054: LocateRequest to remote: key<NameService>
omniORB: (1) 2020-11-06 12:50:37.443022: giopRendezvouser task execute for giop:tcp:10.0.0.247:57082
omniORB: (2) 2020-11-06 12:50:37.443166: AsyncInvoker: thread id 2 has started. Total threads = 2.
omniORB: (2) 2020-11-06 12:50:37.443199: AsyncInvoker: thread id 2 assigned to general tasks. Total general threads = 2.
omniORB: (2) 2020-11-06 12:50:37.443217: AsyncInvoker: thread id 2 performing immediate general task.
omniORB: (2) 2020-11-06 12:50:37.443232: Scavenger task execute.
omniORB: (1) 2020-11-06 12:50:37.493125: SocketCollection idle. Sleeping.
omniORB: (0) 2020-11-06 12:50:38.443279: Client attempt to connect to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:50:38.443411: Client opened connection to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:50:38.443423: sendChunky: to giop:tcp:10.0.0.247:2809 35 bytes
omniORB: (0) 2020-11-06 12:50:38.443432:
4749 4f50 0102 0103 1700 0000 0200 0000 GIOP............
0000 7665 0b00 0000 4e61 6d65 5365 7276 ..ve....NameServ
6963 65 ice
omniORB: (0) 2020-11-06 12:50:38.443236: omniORB: (0) 2020-11-06 12:50:37.443107: omniORB: (0) 2020-11-06 12:50:38.444269: inputMessage: from giop:tcp:10.0.0.247:2809 20 bytes
omniORB: (0) 2020-11-06 12:50:38.444312:
4749 4f50 0102 0104 0800 0000 0200 0000 GIOP............
0100 0000 ....
omniORB: (0) 2020-11-06 12:50:38.444395: Send codeset service context: (ISO-8859-1,UTF-16)
omniORB: (0) 2020-11-06 12:50:38.444426: sendChunky: to giop:tcp:10.0.0.247:2809 92 bytes
omniORB: (0) 2020-11-06 12:50:38.444439:
4749 4f50 0102 0100 5000 0000 0400 0000 GIOP....P.......
0300 0000 0000 0000 0b00 0000 4e61 6d65 ............Name
5365 7276 6963 6578 1100 0000 6269 6e64 Servicex....bind
5f6e 6577 5f63 6f6e 7465 7874 0069 4f52 _new_context.iOR
0100 0000 0100 0000 0c00 0000 0100 0000 ................
0100 0100 0901 0100 0000 0000 ............
omniORB: (0) 2020-11-06 12:50:38.444419: omniORB: (0) 2020-11-06 12:50:38.444414: JET052
omniORB: (0) 2020-11-06 12:50:38.444914: inputMessage: from giop:tcp:10.0.0.247:2809 80 bytes
omniORB: (0) 2020-11-06 12:50:38.444958:
4749 4f50 0102 0101 4400 0000 0400 0000 GIOP....D.......
0100 0000 0000 0000 3400 0000 4944 4c3a ........4...IDL:
6f6d 672e 6f72 672f 436f 734e 616d 696e omg.org/CosNamin
672f 4e61 6d69 6e67 436f 6e74 6578 742f g/NamingContext/
496e 7661 6c69 644e 616d 653a 312e 3000 InvalidName:1.0.
./go.sh: line 46: 28855 Segmentation fault (core dumped) ./eg3_impl
......and here's here's what I'm seeing the echo example do
omniORB: (0) 2020-11-06 12:59:50.031354: LocateRequest to remote: key<NameService>
omniORB: (2) 2020-11-06 12:59:50.031466: AsyncInvoker: thread id 2 has started. Total threads = 2.
omniORB: (2) 2020-11-06 12:59:50.031512: AsyncInvoker: thread id 2 assigned to general tasks. Total general threads = 2.
omniORB: (2) 2020-11-06 12:59:50.031552: AsyncInvoker: thread id 2 performing immediate general task.
omniORB: (2) 2020-11-06 12:59:50.031575: Scavenger task execute.
omniORB: (1) 2020-11-06 12:59:50.081241: SocketCollection idle. Sleeping.
omniORB: (0) 2020-11-06 12:59:51.031650: Client attempt to connect to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:59:51.031799: Client opened connection to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:59:51.031812: sendChunky: to giop:tcp:10.0.0.247:2809 35 bytes
omniORB: (0) 2020-11-06 12:59:51.031822:
4749 4f50 0102 0103 1700 0000 0200 0000 GIOP............
0000 206c 0b00 0000 4e61 6d65 5365 7276 .. l....NameServ
6963 65 ice
omniORB: (0) 2020-11-06 12:59:51.031607: omniORB: (0) 2020-11-06 12:59:50.031417: omniORB: (0) 2020-11-06 12:59:51.032369: inputMessage: from giop:tcp:10.0.0.247:2809 20 bytes
omniORB: (0) 2020-11-06 12:59:51.032405:
4749 4f50 0102 0104 0800 0000 0200 0000 GIOP............
0100 0000 ....
omniORB: (0) 2020-11-06 12:59:51.032463: Send codeset service context: (ISO-8859-1,UTF-16)
omniORB: (0) 2020-11-06 12:59:51.032505: sendChunky: to giop:tcp:10.0.0.247:2809 119 bytes
omniORB: (0) 2020-11-06 12:59:51.032512:
4749 4f50 0102 0100 6b00 0000 0400 0000 GIOP....k.......
0300 0000 0000 0000 0b00 0000 4e61 6d65 ............Name
5365 7276 6963 656f 1100 0000 6269 6e64 Serviceo....bind
5f6e 6577 5f63 6f6e 7465 7874 0072 6561 _new_context.rea
0100 0000 0100 0000 0c00 0000 0100 0000 ................
0100 0100 0901 0100 0100 0000 0500 0000 ................
7465 7374 006e 6563 0b00 0000 6d79 5f63 test.nec....my_c
6f6e 7465 7874 00 ontext.
omniORB: (0) 2020-11-06 12:59:51.032501: omniORB: (0) 2020-11-06 12:59:51.032496: JET052
omniORB: (0) 2020-11-06 12:59:51.033479: inputMessage: from giop:tcp:10.0.0.247:2809 81 bytes
omniORB: (0) 2020-11-06 12:59:51.033528:
4749 4f50 0102 0101 4500 0000 0400 0000 GIOP....E.......
0100 0000 0000 0000 3500 0000 4944 4c3a ........5...IDL:
6f6d 672e 6f72 672f 436f 734e 616d 696e omg.org/CosNamin
672f 4e61 6d69 6e67 436f 6e74 6578 742f g/NamingContext/
416c 7265 6164 7942 6f75 6e64 3a31 2e30 AlreadyBound:1.0
00 .
analyzing these two runs, I note that the strings for "test" and "my_context" are missing from the "bind_new_context" message in the broken code... (this is why the naming service responds with an "invalid name" exception). In the broken code, the message is smaller, and the size field at the front of the message reflects the smaller size.
This is consistant with the "bind_new_context" function getting called with no argument (or with a NULL argument) in the broken code. But both examples use the same source code; calling the same bind_new_context function with the same rootContext and contextName variables, and populated the same way. So I presume there's got to be some kind of environment confusion that my build script introduces that isn't present in version compiled from within omniORB. This might also explain why the cleanup code has broken as well. But I've spent 2 days trying to shake it loose and I've come up empty.
Any ideas?
edit: this is the output from the tree's makefile that I based my build script on. There are differences, but nothing that seems substantive.
[jasont@dodeca3 echo]$ make veryclean ; make VERBOSE=1
rm -f eg1 eg2_impl eg2_clt eg3_impl eg3_clt \
eg3_tieimpl
rm -f *.o *.a
rm -f *.d
rm -f *.pyc
rm -f ../../../stub/echo.idl ../../../stub/echo.hh ../../../stub/echoSK.cc ../../../stub/echoDynSK.cc ../../../stub/echoSK.o ../../../stub/echoDynSK.o ../../../stub/echoSK.d ../../../stub/echoDynSK.d ../../../stub/dir.mk
dir=../../../stub; if [ ! -d $dir ]; then (umask 022; set -x; ../../../../bin/scripts/omkdirhier $dir); fi
rm -f ../../../stub/echo.idl
../../../bin/omniidl -bcxx -Wba -Wbtp -C../../../stub ../../../../idl/echo.idl
../../../bin/omkdepend -D__cplusplus -D__GNUG__ -D__GNUC__ -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ ../../../../src/examples/echo/eg3_clt.cc ../../../../src/examples/echo/eg3_impl.cc ../../../../src/examples/echo/eg2_clt.cc ../../../../src/examples/echo/eg2_impl.cc ../../../../src/examples/echo/eg1.cc
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ -o eg1.o ../../../../src/examples/echo/eg1.cc
cd ../../../stub
make[1]: Entering directory `/home/jasont/FACE_translator/omniORB-4.2.3/build2/stub'
../bin/omkdepend -D__cplusplus -D__GNUG__ -D__GNUC__ -D__OMNIORB4__ -I../stub -D_REENTRANT -I. -I. -I../include -I/home/jasont/FACE_translator/omniORB-4.2.3/include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ echoDynSK.cc echoSK.cc
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../stub -D_REENTRANT -I. -I. -I../include -I/home/jasont/FACE_translator/omniORB-4.2.3/include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ -o echoSK.o echoSK.cc
make[1]: Leaving directory `/home/jasont/FACE_translator/omniORB-4.2.3/build2/stub'
+ rm -f eg1
+ g++ -o eg1 -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg1.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ -o eg2_impl.o ../../../../src/examples/echo/eg2_impl.cc
+ rm -f eg2_impl
+ g++ -o eg2_impl -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg2_impl.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ -o eg2_clt.o ../../../../src/examples/echo/eg2_clt.cc
+ rm -f eg2_clt
+ g++ -o eg2_clt -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg2_clt.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ -o eg3_impl.o ../../../../src/examples/echo/eg3_impl.cc
+ rm -f eg3_impl
+ g++ -o eg3_impl -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg3_impl.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ -o eg3_clt.o ../../../../src/examples/echo/eg3_clt.cc
+ rm -f eg3_clt
+ g++ -o eg3_clt -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg3_clt.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86_64__ -o eg3_tieimpl.o ../../../../src/examples/echo/eg3_tieimpl.cc
+ rm -f eg3_tieimpl
+ g++ -o eg3_tieimpl -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg3_tieimpl.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
Upvotes: 0
Views: 77