Archived

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

updating ServerInstanceDescriptor properties crash

I am working on having a server implementation update its own ServerInstanceDescriptor to add and update parameters at run time as needed. (using Ice 3.4.2)

the following code seems to successfully set a property "key"=>"value" (as viewed in icegrid-gui)
however immidiately thereafter I recieve,
failed in updateApplication: ConnectionI.cpp:322: Ice::CommunicatorDestroyedException:

not sure if I am doing something wrong, if this is a bug in updateApplication(), or if this is an unsupported operation?

            std::string serverid =  c->getProperties()->getProperty("Ice.Admin.ServerId");
            IceGrid::ServerInfo info = admin->getServerInfo(serverid.c_str());

            // get references to current server instance descriptor & add new parameter
            std::vector<IceGrid::ServerInstanceDescriptor> running_instances;
            running_instances = admin->getApplicationInfo(info.application).descriptor.nodes[info.node].serverInstances;
            std::string index = serverid.substr( serverid.find("-")+1, serverid.length() );
            IceGrid::ServerInstanceDescriptor instance;
            for(int i=0; i<running_instances.size(); i++){
                std::cout << "template: " << running_instances[i]._cpp_template << "\n";
                std::cout << "index: " << running_instances[i].parameterValues["index"] << "\n";
                if( index.compare(running_instances[i].parameterValues["index"]) == 0 ){
                    instance = running_instances[i];
                    printf("match.\n");
                    break;
                }
            }

            // make node update descriptor
            IceGrid::NodeUpdateDescriptor node_update;
            node_update.name = info.node;

            // Add new property value to server template-instance property
            IceGrid::PropertyDescriptor prop;
            prop.name = "key";
            prop.value = "value";
            instance.propertySet.properties.push_back(prop);
            node_update.serverInstances.push_back(instance);

            // make application update descriptor
            IceGrid::ApplicationUpdateDescriptor app_update;
            app_update.name = info.application;
            app_update.nodes.push_back(node_update);

            try {
                admin->updateApplication(app_update);
            } catch(IceGrid::DeploymentException& ex){
                std::cout << "failed in updateApplication(deployexception): " << ex.what()<< "\n";
                std::cout << "reason: " << ex.reason << "\n";
            } catch(::Ice::Exception& ex){
                std::cout << "failed in updateApplication: " << ex.what()<< "\n";
            }
            printf("updateApp called\n");

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Which Ice version and platform do you use?

    You're code looks fine. Can you copy/paste the exact error message? It's not also not clear to me what is crashing, is it the IceGrid registry or your application getting a CommunicatorDestroyedException?

    Cheers,
    Benoit.
  • the only error message I get from the server implementation is the following exception during updateApplication(), it is not particularly helpful.

    ConnectionI.cpp:322: Ice::CommunicatorDestroyedException

    the client who is doing a blocking call to the server at the time gets the following,

    Ice.ConnectionLostException: Ice.ConnectionLostException:
    recv() returned zero

    The CommunicatorDestroyedException typically occurs only in the server implementation, but it seems like it is occasionally occuring in the registry communicator as well during the updateApplication() call. I was unable to connect using the icegrid-gui until restarting the icegridnode completely in these cases.
    Several times this event also seemed to cause my X window manager to crash as if there was some major memory corruption occuring.

    I am running ubuntu 12.04 x86_64 and using the standard ubuntu Ice packages, version 3.4.2-4ubuntu1
    Thanks,
  • benoit
    benoit Rennes, France
    Hi,

    When you update the properties of the server, IceGrid will try to re-start the server after the update. It looks like the restart isn't working correctly in your case. Is the server restart hanging? Is the server crashing when it's being deactivated?

    The Ice::CommunicatorDestroyedException in the sever is likely caused by IceGrid trying to stop the server.

    In any case, it shouldn't be necessary to restart IceGrid because of something going wrong with the server restart. The easiest for us to investigate this would be to provide us a small test case that reproduces the problem.

    Cheers,
    Benoit.