Child process does not exit after receiving SIGTERM

Discussion in 'C Programming' started by Teresa, Apr 5, 2004.

  1. Teresa

    Teresa Guest

    Platform: Unix Tru 64 OSF 4.0D

    Problem:
    I spawned 3 processes. Proc A, B and C. My problem is that the
    parent process, proc A, sends SIGTERM to proc C; However, proc C
    does not exit some of the time. Proc C becomes a zombie and init does
    not clean it up.

    The following is how proc A, B and C are set up.

    Proc A
    / \
    / \
    / \ Connected_socket
    Proc B <----> Proc C <---------------------> Some_other_server

    Proc A is the parent of B and C. Proc B and C exchange data. Proc C
    reads data from proc B, writes it to a conneted socket on another
    server. Then proc C reads data from the connected socket and sends
    this data to proc B.

    Process B always ends first. When proc B, is done, it exits. The
    parent, proc A, is notified proc B exited via waitpid(). Then the
    parent, proc A, sends a SIGTERM to proc C. Proc C's SIGTERM handler
    closes the connected socket and then calls exit(1); Hoever, sometimes
    Proc C does not exit. Since the parent process, proc A, does not have
    anymore children proceses, it exists leaving Proc C to be inherited by
    init, process 1. The only way to end Proc C is to send SIGKILL from
    the Unix prompt.

    I appreatiate any ideas/solutions you may provide.

    Thanks
    -Teresa
     
    Teresa, Apr 5, 2004
    #1
    1. Advertising

  2. Teresa <> spoke thus:

    > Problem:
    > I spawned 3 processes. Proc A, B and C. My problem is that the
    > parent process, proc A, sends SIGTERM to proc C; However, proc C
    > does not exit some of the time. Proc C becomes a zombie and init does
    > not clean it up.


    > I appreatiate any ideas/solutions you may provide.


    Your post is off-topic for comp.lang.c. Please visit

    http://www.ungerhu.com/jxh/clc.welcome.txt
    http://www.eskimo.com/~scs/C-faq/top.html
    http://benpfaff.org/writings/clc/off-topic.html

    for posting guidelines and frequently asked questions. Thank you.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, Apr 5, 2004
    #2
    1. Advertising

  3. Teresa

    Rob Thorpe Guest

    (Teresa) wrote in message news:<>...
    > Platform: Unix Tru 64 OSF 4.0D
    >
    > Problem:
    > I spawned 3 processes. Proc A, B and C. My problem is that the
    > parent process, proc A, sends SIGTERM to proc C; However, proc C
    > does not exit some of the time. Proc C becomes a zombie and init does
    > not clean it up.
    >
    > The following is how proc A, B and C are set up.
    >
    > Proc A
    > / \
    > / \
    > / \ Connected_socket
    > Proc B <----> Proc C <---------------------> Some_other_server
    >
    > Proc A is the parent of B and C. Proc B and C exchange data. Proc C
    > reads data from proc B, writes it to a conneted socket on another
    > server. Then proc C reads data from the connected socket and sends
    > this data to proc B.
    >
    > Process B always ends first. When proc B, is done, it exits. The
    > parent, proc A, is notified proc B exited via waitpid(). Then the
    > parent, proc A, sends a SIGTERM to proc C. Proc C's SIGTERM handler
    > closes the connected socket and then calls exit(1); Hoever, sometimes
    > Proc C does not exit. Since the parent process, proc A, does not have
    > anymore children proceses, it exists leaving Proc C to be inherited by
    > init, process 1. The only way to end Proc C is to send SIGKILL from
    > the Unix prompt.
    >
    > I appreatiate any ideas/solutions you may provide.
    >
    > Thanks
    > -Teresa


    Ask comp.unix.programmer
     
    Rob Thorpe, Apr 6, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Athan
    Replies:
    0
    Views:
    417
    Andrew Athan
    Jan 6, 2004
  2. Andrew Athan
    Replies:
    0
    Views:
    471
    Andrew Athan
    Jan 6, 2004
  3. Andrew Athan
    Replies:
    0
    Views:
    973
    Andrew Athan
    Jan 6, 2004
  4. Jeff Epler
    Replies:
    0
    Views:
    863
    Jeff Epler
    Jan 6, 2004
  5. Replies:
    2
    Views:
    468
    Jeff Epler
    May 31, 2005
Loading...

Share This Page