[omniORB] Who's cleaning up servants?

Peter Schaefer-Hutter schaefer.hutter at gmail.com
Sun Sep 25 21:50:35 BST 2005


Hello!

Sorry for this noob question, but i'm wondering who's cleaning up
servants, because my servants' destructor gets never called.

void main(void)
{
    g_orb = CORBA::ORB_init(argc, argv);
    CORBA::Object_var ref = g_orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var root_poa = PortableServer::POA::_narrow(ref.in());
    PortableServer::POAManager_var poa_mgr = root_poa->the_POAManager();
    poa_mgr->activate();
    PortableServer::ServantBase_var obj = new Servant_impl(root_poa.in());
    PortableServer::ObjectId_var oid = root_poa->activate_object(obj.in());
    CORBA::Object_ptr p = root_poa->id_to_reference(oid.in());
    Servant_var cvServant = Servant::_narrow(p);
    CORBA::release(p);
    assert(!CORBA::is_nil(cvServant.in()));

    [...]

    root_poa->deactivate_object(oid.in());
    g_orb->destroy();
    return 0;
}

This is a more-or-less straight-forward example from a CORBA book. But even
after "deactivate_object" the destructor of the servant isn't called.

If i do it like that

    Servant_impl *pS = new Servant_impl(root_poa.in());
    PortableServer::ServantBase_var obj = pS;

    [ ... ]

    root_poa->deactivate_object(oid.in());
    delete pS;
    g_orb->destroy();

the destructor gets called, but i *sometimes* get

omniORB: Assertion failed.  This indicates a bug in the application using
omniORB, or maybe in omniORB itself.
 file: ../../../../../src/lib/omniORB/orbcore/corbaObject.cc
 line: 264
 info: !_NP_is_pseudo()

Enlightment please?

Best regards,

 Peter




More information about the omniORB-list mailing list