Results 1 to 5 of 5

Thread: Server shutdown with Ctrl-C vs. Process

  1. #1
    n2503v is offline Registered User
    Name: Alex Makarenko
    Organization: ACFR, University of Sydney
    Project: Orca
    Join Date
    Jun 2005
    Posts
    134

    Server shutdown with Ctrl-C vs. Process

    Hi,
    I recently changed my server implementation to perform a network operation (unsubscribe from IceStorm) before shutting down. In my class derived from Ice::Application I re-implement the new interruptCallback() function to do this.

    This works well when the application executes from the command line and is stopped with Ctrl-C.

    I expected this to work similarly with IceGrid but it doesn't seem to. It looks like the communicator is destroyed right away. Is this to be expected? I couldn't find an explicit reference in the manual to what the ProcessI object does when shutdown() is called.

    "When shutdown is invoked, the object implementing this interface is expected to initiate the termination of its server process." (28.18.4)

    Thanks a lot, Alex
    Alex Makarenko
    Marathon Robotics
    project: multi-robot systems

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi Alex,

    The default process interface (or admin facet if you use Ice 3.3.0) simply calls the communicator shutdown method which unblocks the thread waiting on waitForShutdown (the main thread in general).

    Why don't you unsubscribe form IceStorm after the waitForShutdown method returns? You can still perform Ice invocations after waitForShutdown returns (client side invocations can't be performed until the communicator destroy method is called). This way, you can use the default interrupt callback and process interface.

    Otherwise, you'll need to override the default process interface as well (or admin facet if you use Ice 3.3.0). Let us know if you need more information on this.

    Cheers,
    Benoit.

  3. #3
    n2503v is offline Registered User
    Name: Alex Makarenko
    Organization: ACFR, University of Sydney
    Project: Orca
    Join Date
    Jun 2005
    Posts
    134
    Thanks Benoit,
    I understand the issues now. I was missing the fact that ProcessI shuts down the communicator. (and I forgot the difference between the communicator's shutdown and destroyed states).

    I prefer, of course, that my application behaves the same when run manually or by IceGrid. So, practically, that means calling shutdownOnInterrupt() and then waitForShutdown() as you suggested.

    This is not perfect for what I was trying to achieve, however. I wanted to keep the communicator fully functional until I unsubscribe from IceStorm. At high data rate, chances are high that an incoming message from IceStorm bounces off between the time the communicator is shutdown and the time when my application gets a chance to unsubscribe.

    The reason I am looking into this: I'm trying to debug a rare case when some part of the multi-component system gets blocked or runs out of threads and, it seems to have something to do with IceStorms subscriptions or deliveries. The way to induce this condition is by cycling the system up and down (through IceGrid). The problem is that, with component not unsubscribing before shutdown, IceStorm continuously reports "subscriber errored out" so it's hard to separate expected errors from the unexpected. I was hoping to quiet everything down a bit to clarify things.

    Anyway, I'll look for other ways to debug this. Reimplementing the Process interface seems like an overkill.

    Meanwhile, if you are taking suggestions, it would be nice to have some parity/compatibility in options for shutting down behavior between Ice::Application and IceGrid. I guess the old option of using signals instead of Process interface would be useful in this case.

    Thanks for your help,
    Alex
    Alex Makarenko
    Marathon Robotics
    project: multi-robot systems

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Quote Originally Posted by n2503v View Post
    Thanks Benoit,
    Meanwhile, if you are taking suggestions, it would be nice to have some parity/compatibility in options for shutting down behavior between Ice::Application and IceGrid. I guess the old option of using signals instead of Process interface would be useful in this case.
    If you use Ice 3.3.0, you can disable the process registration by setting Ice.Admin.Endpoints to an empty string in the server configuration. This will disable the Ice.Admin plugin and IceGrid will use the SIGTERM signal instead of the process interface to shutdown the server.

    Cheers,
    Benoit.

  5. #5
    n2503v is offline Registered User
    Name: Alex Makarenko
    Organization: ACFR, University of Sydney
    Project: Orca
    Join Date
    Jun 2005
    Posts
    134
    Excellent! I tried it and gives me all the options I need.

    (I knew how to disable the Admin interface but wan't sure that the Node will resort to sending signals in that case. It is rather obvious in retrospect. )

    alex
    Alex Makarenko
    Marathon Robotics
    project: multi-robot systems

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can a process be both a Client and Server?
    By duckjones in forum Help Center
    Replies: 5
    Last Post: 11-30-2010, 11:01 PM
  2. Client disconnect causes server to shutdown
    By cmeyers in forum Help Center
    Replies: 8
    Last Post: 03-28-2008, 10:35 PM
  3. Replies: 6
    Last Post: 05-17-2006, 05:24 PM
  4. Forking Process within Ice Server
    By acbell in forum Help Center
    Replies: 1
    Last Post: 07-25-2005, 01:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •