Archived
This forum has been archived. Please start a new discussion on GitHub.
Problems with user-defined types
Hello!!
I am having problems when I use an operation with a parameter like the following (TDFAgentDescription):
struct TDFServiceDescription
{
string Name;
string Type;
};
sequence <TDFServiceDescription> TDFServiceDescriptions;
struct TDFAgentDescription
{
TAID Name;
TDFServiceDescriptions Services;
};
If I launch a client written in Python that stores a value in Services and that calls an operation which uses the TDFAgentDescription parameter later, the server written in C++ will raise an Ice::ConnectionLostException.
I have reviewed the problem many times, but I have not found the problem yet. I know that the connection is only losed when the parameter Services has at least one element, but if I initialize Services = [] there is no problem.
Thank you very much!!
I am having problems when I use an operation with a parameter like the following (TDFAgentDescription):
struct TDFServiceDescription
{
string Name;
string Type;
};
sequence <TDFServiceDescription> TDFServiceDescriptions;
struct TDFAgentDescription
{
TAID Name;
TDFServiceDescriptions Services;
};
If I launch a client written in Python that stores a value in Services and that calls an operation which uses the TDFAgentDescription parameter later, the server written in C++ will raise an Ice::ConnectionLostException.
I have reviewed the problem many times, but I have not found the problem yet. I know that the connection is only losed when the parameter Services has at least one element, but if I initialize Services = [] there is no problem.
Thank you very much!!
0
Comments
-
Hi David,
It's not quite clear from your description whether it's the Python client or the C++ server that reports ConnectionLostException. Is one of them crashing with a segmentation fault? If so, examining the stack trace might provide useful information.
Have you tried writing a client in a different language that sends the same data to the server?
If you can write a small test case that reproduces the problem, we'd be happy to take a look at it.
Please also specify your versions of Ice, operating system, and compiler.
Take care,
- Mark0 -
Hello!!
I use Debian, Ice 3.0.1, and g++-4.0.
I use IceGrid for the server side, and the message I obtain from icegridnode is the following:
[ icegridnode: Activator: detected termination of server `DirectoryFacilitator'
signal = SIGSEGV ]
On the other hand, I initialize the client with the next code (which causes the error):
class AgentI (FIPA.Agent, Ice.Application):
"""La clase AgentI representa un agente genérico"""
def __init__ (self, name):
"""Crea un objeto del tipo AgentI"""
# AgentIdentifier representa la identificación del agente: name y addresses.
self.AgentIdentifier = FIPA.TAID(name + '@MASYRO', [])
# AgentDescription representa la descripción del agente en el Directory Facilitator.
service = FIPA.TDFServiceDescription('render', 'render')
self.AgentDescription = FIPA.TDFAgentDescription(self.AgentIdentifier, [service])
# AgentDescriptions representa la lista de objetos que describen a otros agentes del Directory Facilitator.
self.AgentDescriptions = []
# State representa el estado del agente en la plataforma de agentes.
self.State = FIPA.EState.Initiated
# ServiceRoot representa la lista de servicios básicos de la plataforma.
self.ServiceRoot = []
# Proxies a los servicios básicos de la plataforma de agentes.
self.StartService, self.Ams, self.Df, self.Acc = None, None, None, None
And this is the call that causes the error:
explanation = self.getDf().register(self.getAgentDescription())
where the getDf() operation returns a proxy to the object which is implemented by the DirectoryFacilitator server.
The error which I obtain from the client side is the following:
warning: connection exception:
TcpTransceiver.cpp:217: Ice::ConnectionLostException:
connection lost: recv() returned zero
local address = 192.168.1.4:40999
remote address = 192.168.1.3:2942
Traceback (most recent call last):
File "/usr/lib/site-python/Ice.py", line 487, in main
status = self.run(args)
File "Agent.py", line 496, in run
topic, proxy = self.subscribeDF(adapter)
File "Agent.py", line 453, in subscribeDF
explanation = self.getDf().register(self.getAgentDescription())
File "../FIPA/FIPA.ice", line 862, in register
ConnectionLostException: Ice.ConnectionLostException:
recv() returned zero
I am going to write a test client in another language as you have advised me.
Thank you very much!!0 -
Hi,
Since your server appears to be crashing, it shouldn't matter which language you use in your client; the server should receive the same data over the network. I suspect you have a bug in your server that causes the crash, so you should check the stack trace of the segmentation fault for more information.
Good luck!
- Mark0