Monday, May 28, 2007, 9:46:12 PM, Udo wrote:
> The shutdown script has always been a fire-and-forget script that did 
> not evaluate any return codes or output. The only change that landed 
> together with the VDR shutdown rewrite in 1.5.1 is that the script is 
> now called detached from VDR, so it can run in parallel and will not 
> terminate together with VDR. Some shutdown scripts may need to be adapted.

> If you want to investigate: thread.c:SystemExec() is called with the new 
> parameter Detached=true. STDIN is redirected to /dev/null, STDOUT and 
> STDERR are same as VDR, all other FD's get closed as before.

You can reproduce the problem pretty easy:

If I use an 'empty' shutdown script that just starts with "#!/bin/sh" or
bash or whatever, the script itself becomes a zombie. And if I use a script
with just an empty line, "sh" becomes the zombie. So in either way,
something is wrong and it can not be the script's fault.

It would be helpful if someone could test this behavior. 

My assumption is that the problem occurs because of the missing wait
call (if SystemExec is called 'detached'). I know, if VDR would wait
in there, the script wouldn't run simultaneously. But if VDR never
waits for the child's PID, the child's termination never gets handled
and imho that's why the script remains as a zombie.

waitpid( -1, &dummy, WNOHANG) called at some place later should do the
trick. Or waitpid() explicitly for the child's PID, if we want to store
the PID anywhere.


vdr mailing list

Reply via email to