Find the answer to your Linux question:
Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2011

    How to kill inetd server's child processes after client disconnect?

    Dear Forum,

    I'm running uClinux on a softcore CPU. The application is a motion server. I used inetd to listen on a port and launch my server application. Sometimes, the client will make a request that causes the server program to vfork and execl another process to deal with the client's request. Normally, the client will end the session with sensible commands and the server program gracefully uses SIGTERM to kill the child processes it has produced. However, when the client severs the connection abruptly, inetd terminates the server program, but the child processes are still runnning. I've tried to fix this problem by catching SIGTERM from inetd in the server program and gracefully terminating the server's child processes. This fails to work when the client abruptly disconnects, yet it works if I kill the server from the terminal with kill <server pid>; I don't understand this failure because inetd.c seems to kill stuff by issuing SIGTERM. What am I missing?


    Edit: It seems that SIGTERM is not the problem. When a client abruptly disconnects, an EOF appears in the server's stdin stream. This can be used to trigger a gracefully reap the server's child processes.
    Last edited by stebla; 06-09-2011 at 02:09 PM. Reason: Fixed the problem

Posting Permissions

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