Archived

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

NullHandleException on server exit with CommunicationObserver

Hello,

I'm experimenting with CommunicatorObserver and it works but I can't get my server to exit cleanly. To track it down I've modified the Hello demo server and I'm getting the same result.

I define a CommunicatorObserverImpl which returns zeros for all observers and pass an instance of it to Ice::Application.
class CommunicatorObserverImpl : public Ice::Instrumentation::CommunicatorObserver
{
public:
    ::Ice::Instrumentation::ObserverPtr getConnectionEstablishmentObserver(const ::Ice::EndpointPtr&, const ::std::string&) { return 0; }
...
    void setObserverUpdater(const ::Ice::Instrumentation::ObserverUpdaterPtr& updater) {}
};

class HelloServer : public Ice::Application
{
public:
    ~HelloServer()
    {
        cout<<__func__<<endl;
    }

    virtual int run(int, char*[]);
};

int
main(int argc, char* argv[])
{
    HelloServer app;

//    return app.main(argc, argv, "config.server");

    Ice::InitializationData id;
    id.observer = new CommunicatorObserverImpl;
    return app.main(argc, argv, id);
}

The server works as expected but throws an exception on Ctrl-C. Any ideas on what's happening?
$ ./server --Ice.Config=config.server
Hello World!
Hello World!

^C!! 05/31/15 12:02:02.894 ./server: error: (while destroying in response to signal 2): ../../include/IceUtil/Handle.h:46: IceUtil::NullHandleException
     0 IceUtil::Exception::Exception(char const*, int) in /opt/Ice-3.5.1/lib/libIceUtil.so.35
     1 IceUtil::NullHandleException::NullHandleException(char const*, int) in /opt/Ice-3.5.1/lib/libIceUtil.so.35
     2 IceUtil::HandleBase<IceInternal::CommunicatorObserverI>::throwNullHandleException(char const*, int) const in /opt/Ice-3.5.1/lib/libIce.so.35
     3 IceUtil::HandleBase<IceInternal::CommunicatorObserverI>::operator->() const in /opt/Ice-3.5.1/lib/libIce.so.35
     4 IceInternal::Instance::destroy() in /opt/Ice-3.5.1/lib/libIce.so.35
     5 Ice::CommunicatorI::destroy() in /opt/Ice-3.5.1/lib/libIce.so.35
     6 /opt/Ice-3.5.1/lib/libIce.so.35(+0x37490a) [0x7f979f44890a]
     7 /opt/Ice-3.5.1/lib/libIceUtil.so.35(+0x4288e) [0x7f979ee9b88e]
     8 /lib/x86_64-linux-gnu/libpthread.so.0(+0x80ca) [0x7f979e4220ca]
     9 clone() in /lib/x86_64-linux-gnu/libc.so.6
~HelloServer

Thanks, Matt.

Comments

  • benoit
    benoit Rennes, France
    Hi Matt,

    This is a known problem with custom observers. I recommend to try out Ice 3.6b instead which has a fix for this problem. The final version will be released in few days.

    Cheers,
    Benoit.