Archived

This forum has been archived. Please start a new discussion on GitHub.

IceE-1.2.0 running...

Hi,

I have compiled IceE for an target system with PPC processor.
When I launch the "Hello World" test. I stay lock on this line (and crash):

"Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");"

It always I know because I debug with printf... In fact there are no gdb on target system...

What Ice doing at this point? Where the problem could to be?

Thanks.
Cheers,
Sebastien.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    The object adapter resolves the host names from the object adapter endpoints and then creates a server socket each of the endpoints. What are the endpoints of the Hello adapter? You should first try with the loopback interface, by setting the following property for example: "Hello.Endpoints=tcp -h 127.0.0.1 -p 12345"

    Cheers,
    Benoit.
  • Hi,

    The endpoint is "-p 10000" with no given address.
    But with your configuration line, (loopback) the server crash at the same point.

    Cheers,
    Sebastien.
  • benoit
    benoit Rennes, France
    Hi Sébastien,

    I'm afraid there isn't much we can do to help here. You need to figure out where the Ice runtime is hanging to figure out what could be the problem. If you can't easily use a debugger and since it's most likely hanging in some network related functions, you could add some tracing in the methods createSocket, doBind, getAddress, etc from src/IceE/Network.cpp.

    Cheers,
    Benoit.
  • Hi Benoit,

    I have found where comes from the problem.

    setsockopt in setKeepAlive function (Network.cpp): throw exception.

    when I print setsockopt result, the value is not the same that SOCKET_ERROR. But the program run the if code...

    Cheers,
    Sébastien.
  • Hi,

    SO_KEEPALIVE wasn't defined in my OS. I have just add :

    #define SO_KEEPALIVE 0x0008 as in newlib 1.16...

    Can I comment the setKeepAlive function?

    Cheers,
    Sebastien.
  • matthew
    matthew NL, Canada
    See What exactly does SO_KEEPALIVE do? for details on what SO_KEEPALIVE does. In short, if your application is short lived, or sends data on regular intervals having SO_KEEPALIVE set won't make any difference.
  • Hi,

    I think I don't need SO_KEEPALIVE, I just want run the tests on my embedded system.

    Could you help me with this:
    Program received signal ?, Unknown signal.
    0x018e0900 in abort ()
    (gdb) bt
    #0  0x018e0900 in abort ()
    #1  0x018d7634 in uw_init_context_1 (context=0x70004c10, outer_cfa=0x700056b0,
        outer_ra=0x18ce25c) at ../../gcc-3.4.6/gcc/unwind-dw2.c:1150
    #2  0x018d7940 in _Unwind_RaiseException (exc=0x74416464) at unwind.inc:93
    #3  0x018ce25c in __cxa_throw (obj=0x1934398, tinfo=0x1935628,
        dest=@0x70005d20: 0x1933a54)
        at ../../../../gcc-3.4.6/libstdc++-v3/libsupc++/eh_throw.cc:75
    #4  0x018649cc in IceInternal::doBind(int, sockaddr_in&) (fd=3,
        addr=@0x19359d8) at Network.cpp:439
    #5  0x018c4b64 in Acceptor (this=0x19359a8, instance=@0x1935984,
        host=@0x1935988, port=12345) at ../../src/TcpTransport/Acceptor.cpp:122
    #6  0x018b94cc in IceInternal::TcpEndpoint::acceptor(IceInternal::Handle<IceInte rnal::Endpoint>&) const (this=0x1935968, endp=@0x1934338)
        at ../../src/TcpTransport/TcpEndpoint.cpp:395
    #7  0x018bee00 in IncomingConnectionFactory (this=0x19342e8,
        instance=@0x1936630, endpoint=@0x1935e08, adapter=@0x700059e0)
        at IncomingConnectionFactory.cpp:186
    #8  0x0186b8c4 in ObjectAdapter (this=0x19365e8, instance=@0x1934228,
        communicator=@0x193422c, objectAdapterFactory=@0x70005bb0,
        name=@0x70005d20, endpointInfo=@0x70005ca0, router=@0x70005c60)
        at ObjectAdapter.cpp:685
    #9  0x018778c8 in IceInternal::ObjectAdapterFactory::createObjectAdapter(std::st ring const&, std::string const&, IceInternal::ProxyHandle<IceProxy::Ice::Router> ---Type <return> to continue, or q <return> to quit---
     const&) (this=0x19341e8, name=@0x70005d20, endpoints=@0x70005ca0,
        router=@0x70005c60) at ObjectAdapterFactory.cpp:161
    #10 0x01818bd8 in Ice::Communicator::createObjectAdapterWithEndpoints(std::strin g const&, std::string const&) (this=0x1935628, name=@0x70005d20,
        endpoints=@0x70005ca0) at Communicator.cpp:103
    #11 0x01818ab0 in Ice::Communicator::createObjectAdapter(std::string const&) (
        this=0x1935628, name=@0x70005d20) at Communicator.cpp:97
    #12 0x01805760 in run(int, char**, IceInternal::Handle<Ice::Communicator> const& ) (argc=1, argv=0x70000f08, communicator=@0x70005de0) at Server.cpp:19
    #13 0x01805e50 in main (argc=1, argv=0x70000f08) at Server.cpp:50
    #14 0x01800530 in _start ()
    

    I have just changed this in Network.cpp:
    void
    IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
    {
        memset(&addr, 0, sizeof(struct sockaddr_in));
        addr.sin_family = AF_INET;
        addr.sin_port = htons(port);
        addr.sin_addr.s_addr = inet_addr(host.c_str());
                                                                                                                                                                 
    [COLOR="Red"]#if defined (_MYOS)
        fprintf(stderr, "[Network.cpp] getAddress\n");
    #else[/COLOR]
                                                                                                                                                                 
        if(addr.sin_addr.s_addr == INADDR_NONE)
        {
        #if defined(_WIN32)
                                                                                                                                                                 
            //
            // Windows XP has getaddrinfo(), but we don't want to require XP to run IceE.
            //
                                                                                                                                                                 
            //
            // gethostbyname() is thread safe on Windows, with a separate hostent per thread
            //
            struct hostent* entry;
            int retry = 5;
            do
            {
                entry = gethostbyname(host.c_str());
            }
            while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
                                                                                                                                                                 
            if(entry == 0)
            {
                DNSException ex(__FILE__, __LINE__);
                                                                                                                                                                 
                ex.error = WSAGetLastError();
                ex.host = host;
                throw ex;
            }
            memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
    
        #else
                                                                                                                                                                 
            struct addrinfo* info = 0;
            int retry = 5;
                                                                                                                                                                 
            struct addrinfo hints = { 0 };
            hints.ai_family = PF_INET;
                                                                                                                                                                 
            int rs = 0;
            do
            {
                rs = getaddrinfo(host.c_str(), 0, &hints, &info);
            }
            while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
                                                                                                                                                                 
            if(rs != 0)
            {
                DNSException ex(__FILE__, __LINE__);
                ex.error = rs;
                ex.host = host;
                throw ex;
            }
                                                                                                                                                                 
            assert(info->ai_family == PF_INET);
            struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
                                                                                                                                                                 
            addr.sin_addr.s_addr = sin->sin_addr.s_addr;
            freeaddrinfo(info);
                                                                                                                                                                 
        #endif
        }
    #endif
    }
    

    Thanks,
    Sebastien.
  • matthew
    matthew NL, Canada
    I don't think there is any help we can offer with that. It looks to me that your embedded system or compiler has some issue with exception handling...
  • Hi,

    The error returned by Ice is:

    Network: attempting to bind to tcp socket 127.0.0.1:12345

    Cheers,
    Sebastien.
  • matthew
    matthew NL, Canada
    That is not an error. I'm afraid without more information we cannot help.