in reply to Re^3: Stopped child hangs parent
in thread Stopped child hangs parent

Yes you are correct. The arsload process is also stopped. I was concentrating on the Perl processes so intently I completely missed the arsload process.

When I am testing I am running in the background. When run for real it will run from cron. I was not at a point where I was ready to test it for real yet but based on your question I ran it in the foreground. Everything worked perfectly.

I will look into daemonize'ing the child process as well. Unless there is something else anyone can think of I may be doing wrong, I believe I am good as long as I do not test in the background.

Thank you for everything.

Replies are listed 'Best First'.
Re^5: Stopped child hangs parent
by almut (Canon) on Aug 11, 2009 at 23:00 UTC
    Unless there is something else anyone can think of...

    If the issue is that the terminal is sending SIGTTOU stopping the process when it's trying to write to the terminal from the background (as indicated by ig), you could try  stty -tostop to disable that behavior (most terminals allow it to be controlled):

    $ stty tostop $ echo foo & [1] 7746 [1]+ Stopped echo foo $ stty -tostop $ echo foo & foo [2] 7748 [2]- Done echo foo

    As you can see, in the first case, the background process is being stopped (via SIGTTOU), while in the latter case, the process is allowed to output "foo" (as if being run in the foreground), and the process can terminate normally.

      I tried stty -tostop. Unfortunately it did not perform as hoped. That leaves SIGTTIN possibly. I will be getting back to testing this again soon and put in the traps for SIGTTIN and SIGTTOU. I will post my results.

Re^5: Stopped child hangs parent
by ig (Vicar) on Aug 11, 2009 at 18:38 UTC

    The most likely cause of the stop is that arsload is trying to read or write the terminal and, while being run in the background, is receiving SIGTTIN or SIGTTOU. You have redirected STDERR to a log file. You should do the same for STDOUT and open STDIN from /dev/null. Then you will probably be able to run in the background.

    Rather than doing this in your script, you can do it from the command line:

    ./script.pl >/tmp/script.log </dev/null &