[omniORB] Recursive structures in anys
Michael
omniorb at bindone.de
Mon Mar 31 17:13:16 BST 2008
Hi Duncan,
I'm (still) using omniORB 4.1.0 on FreeBSD 6.2 gcc 3.4.6.
I tried to come up with a minimum example.
Type "make working" to compile the anonymous (working) version, or
"make broken" to do the typedefed (broken) version.
Start server:
./TestServer
<outputs server ior>
Start client:
./TestClient <server ior>
The working client causes:
"Received call"
on the server side.
The broken client doesn't crash in this example, but causes:
omniORB: From endpoint: giop:tcp:192.168.250.2:55048. Detected GIOP 1.2 protocol error in
input message. giopImpl12.cc:863. Connection is closed.
..on the server side (it doesn't matter if server was compiled working or broken).
(in the muhc more complicated production code it still causes Signal 6 - so I assume there
must be something broken in the marshalling code?!?)
cheers
michael
Duncan Grisby wrote:
> On Sunday 30 March, Michael wrote:
>
>> I stumbled over an issue regarding recursive structures in
>> IDLs. Basically it is the same issue posted by Renzo Tomaselli backin
>> 2005 (see below), but I couldn't find any indication that this has
>> ever been fixed.
>
> The issue Renzo reported was fixed in April 2005.
>
> Can you post a complete example that shows the problem? And what
> version of omniORB are you using?
>
> Cheers,
>
> Duncan.
>
-------------- next part --------------
CC=g++
working:
omniidl -bcxx -Wbh=.h -Wbs=.C -Wba -Wbd=_dyn.C Test.idl
$(CC) -pthread -I/usr/local/include -c -o Test.o Test.C
$(CC) -pthread -I/usr/local/include -c -o Test_dyn.o Test_dyn.C
$(CC) -pthread -I/usr/local/include -c -o TestClient.o TestClient.C
$(CC) -pthread -I/usr/local/include -c -o TestServer.o TestServer.C
$(CC) -pthread -L/usr/local/lib -lomniORB4 -lCOSNotify4 Test.o Test_dyn.o TestClient.o -o TestClient
$(CC) -pthread -L/usr/local/lib -lomniORB4 -lCOSNotify4 Test.o Test_dyn.o TestServer.o -o TestServer
broken:
omniidl -bcxx -Wbh=.h -Wbs=.C -Wba -Wbd=_dyn.C -DBROKEN=1 Test.idl
$(CC) -pthread -I/usr/local/include -c -o Test.o Test.C
$(CC) -pthread -I/usr/local/include -c -o Test_dyn.o Test_dyn.C
$(CC) -pthread -I/usr/local/include -c -o TestClient.o TestClient.C
$(CC) -pthread -I/usr/local/include -c -o TestServer.o TestServer.C
$(CC) -pthread -L/usr/local/lib -lomniORB4 -lCOSNotify4 Test.o Test_dyn.o TestClient.o -o TestClient
$(CC) -pthread -L/usr/local/lib -lomniORB4 -lCOSNotify4 Test.o Test_dyn.o TestServer.o -o TestServer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.idl
Type: text/x-idl
Size: 542 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080331/b5866a87/Test.bin
-------------- next part --------------
#include <iostream>
#include "Test.h"
int main(int argc, char** argv)
{
if (argc < 2) return 254;
try
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
Test::List mylist;
mylist.entries.length(1);
mylist.entries[0].entries.length(1);
Test::Envelope cinfo;
cinfo.payload <<= mylist;
CORBA::Object_var obj = orb->string_to_object(argv[1]);
Test::TestServer_var ts = Test::TestServer::_narrow(obj);
ts->call(cinfo);
}
catch(CORBA::Exception& e)
{
std::cerr << "CORBA Exception " << typeid(e).name() << std::endl;
}
catch(...)
{
std::cerr << "Exception" << std::endl;
}
}
-------------- next part --------------
#include <iostream>
#include "Test.h"
class TestServer_impl: virtual public POA_Test::TestServer, virtual public PortableServer::RefCountServantBase
{
public:
TestServer_impl() {}
void call(const Test::Envelope& e)
{
std::cout << "Received call" << std::endl;
}
};
int main(int argc, char** argv)
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
PortableServer::LifespanPolicy_var lifespan = root_poa->create_lifespan_policy(PortableServer::PERSISTENT);
PortableServer::IdAssignmentPolicy_var assign = root_poa->create_id_assignment_policy(PortableServer::USER_ID);
CORBA::PolicyList policy_list;
policy_list.length(2);
policy_list[0] = PortableServer::LifespanPolicy::_duplicate(lifespan);
policy_list[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign);
PortableServer::POA_var TestServer_poa = root_poa->create_POA("TestServer", pman, policy_list);
TestServer_impl impl;
PortableServer::ObjectId_var implId = PortableServer::string_to_ObjectId("TestServer");
TestServer_poa->activate_object_with_id(implId, &impl);
CORBA::Object_var test_obj = impl._this();
CORBA::String_var ior = orb->object_to_string(test_obj);
std::cout << ior << std::endl;
pman->activate();
orb->run();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: recursive.tgz
Type: application/x-compressed-tar
Size: 1386 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080331/b5866a87/recursive.bin
More information about the omniORB-list
mailing list