Results 1 to 7 of 7

Thread: IcePy and shutdown

  1. #1
    alexm is offline Registered User
    Name: Eskinder Alex Mesfin
    Organization: Medtronic, Inc.
    Project: www.medtronic.com
    Join Date
    Apr 2006
    Location
    In Minneapolis, Mn
    Posts
    16

    IcePy and shutdown

    Hi,
    I have a situation where the server started serving multiple instance, shuting it down thru the shutdown mechanism, didn't seem to respond, it takes a long time and eventully I end up killing it, is this normal behaviour or I am missing something.



    I run on Sun Solaris 8
    Compiled pytton 2.4.2 and Ice* with sun stdio 11.
    Alex Mesfin
    Medtronic, Inc.
    www.medtronic.com

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi Alex,

    A server will not complete its shutdown until all pending invocations on its servants have completed. If you don't think this situation is occurring, I suggest attaching a debugger to the server and obtaining a stack trace from each of its threads.

    If you can reproduce this problem consistently with a small example, please post it and we'll take a look at it.

    Take care,
    - Mark

  3. #3
    alexm is offline Registered User
    Name: Eskinder Alex Mesfin
    Organization: Medtronic, Inc.
    Project: www.medtronic.com
    Join Date
    Apr 2006
    Location
    In Minneapolis, Mn
    Posts
    16

    IcePy and shutdown

    how do you shutdown an invocation of a servent initiated by a client.
    Alex Mesfin
    Medtronic, Inc.
    www.medtronic.com

  4. #4
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Quote Originally Posted by alexm
    how do you shutdown an invocation of a servent initiated by a client.
    Ice does not provide the ability to do that, since it usually would require terminating an active thread and would interfere with aspects of the Ice run time.

    One way to implement such a capability at the application level is to use AMD for all servant invocations, maintain a list of outstanding invocations, and design the servants to periodically check for server termination. For a simple server this might be feasible, but in a complex server it's probably not a viable option.

    Finally, make sure you do not call Communicator.destroy() from within a servant invocation, since this will cause a deadlock. You should only call shutdown() from a servant invocation.

    Take care,
    - Mark

  5. #5
    alexm is offline Registered User
    Name: Eskinder Alex Mesfin
    Organization: Medtronic, Inc.
    Project: www.medtronic.com
    Join Date
    Apr 2006
    Location
    In Minneapolis, Mn
    Posts
    16
    How about terminating the client thread instantiated by the servant. It seems the servant is the deamon, am I right? if not how can Ice clean up after the client terminates, and since some pending thread might be the cause of the shutdown delay.
    Alex Mesfin
    Medtronic, Inc.
    www.medtronic.com

  6. #6
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    Sorry, I don't understand your question. If the method invocation in a server hangs or takes a long time to complete then the shutdown of the server will be delayed until this completes. If this is not the behavior that you want you have to do something special.

    Since Ice is a general piece of software, its not possible for us to do anything different. It is not possible to terminate threads in most operating systems safely (ie: using TerminateThread under Win32 is very bad). Any behaviour that terminates your server unconditionally is highly application specific, and therefore not done by Ice itself.

    If you want to absolutely terminate your server you can call exit. One possible strategy I can think of is that when your server is told to shutdown, you spawn a thread which will call exit in, say, 20 seconds. After communicator->waitForShutdown() returns you terminate this thread. If waitForShutdown() does not return, then your server is hanging and the spawned thread will take care of destroying the server for you.

    Note that if you do this you run the risk of losing data -- which is why Ice does not do this

  7. #7
    eritrea is offline Registered User
    Join Date
    Mar 2006
    Posts
    4
    Quote Originally Posted by matthew

    If you want to absolutely terminate your server you can call exit. One possible strategy I can think of is that when your server is told to shutdown, you spawn a thread which will call exit in, say, 20 seconds. After communicator->waitForShutdown() returns you terminate this thread. If waitForShutdown() does not return, then your server is hanging and the spawned thread will take care of destroying the server for you.

    Note that if you do this you run the risk of losing data -- which is why Ice does not do this
    I will try this.
    Alex Mesfin.
    Medtronic Inc.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Shutdown a service
    By spicy in forum Comments
    Replies: 3
    Last Post: 07-06-2007, 09:50 PM
  2. Threads and Shutdown
    By acbell in forum Help Center
    Replies: 1
    Last Post: 11-30-2006, 05:16 AM
  3. shutdown problem
    By dthompson in forum Help Center
    Replies: 4
    Last Post: 06-16-2006, 03:50 PM
  4. Deadlock on Evictor Shutdown
    By acbell in forum Bug Reports
    Replies: 3
    Last Post: 04-26-2006, 09:25 AM
  5. Notification on communicator shutdown
    By stephan in forum Help Center
    Replies: 11
    Last Post: 10-13-2004, 04:38 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
  •