AlanOlsen has asked for the wisdom of the Perl Monks concerning the following question:

I have a Perl program running on AIX. During debugging I occasionally have to kill it with control-c.

However...

It does not die. I get a prompt, but it just sits and spins out in some never-neverland in the process space. Kill -9 will kill it off.

Ideas of where I could be going wrong? I am trying to kill the process, not background it. Not certain how I would do this even if I wanted to. The program is pretty long, so I am not going to try and post it.

Any ideas of where to start looking?

Replies are listed 'Best First'.
Re: The process that would not die
by ambrus (Abbot) on Feb 21, 2006 at 21:58 UTC

    The program might change terminal settings (with the stty program or the Termios functions of POSIX or with low-level ioctls or any other way) in such a way that signal-sending magic characters are not respected (the isig property, or it could change or disable the interrupt character only). Try sending the program a SIGINT with kill -INT instead of control-C to see if it works.

      The kill -INT did not solve it, but it gave me the clue as to what is going on.

      The program has this weird way of logging that throws off a child process. When control-c is pressed, it kills off the logging process and somehow the original controlling process is dropped into background instead of figuring out it should die too.

      Now I know what to fix. Thanks!

Re: The process that would not die
by GrandFather (Saint) on Feb 21, 2006 at 21:25 UTC

    First look for stuff that updates signal handling (code manipulating %SIG) and put diagnostics in any handlers that might get invoked. If that doesn't turn up anything comment out code until the problem goes away, then put it back a bit at a time until the problem comes back :).


    DWIM is Perl's answer to Gödel
      I can't find any code touching the signal handler at all. (The only internals that get mucked with is AUTOLOAD.)

      I guess I will have to build a signal handler for it and see when and if it gets called.