Bug #1539
closedcan't capture lighttpd startup notifications output in perl script
Description
When starting lighttpd through a perl script we are trying to work around the problem mentioned in ticket 1452 (no proper exit value). We decided to capture the output and scan it for the text "going down" indicating a fatal startup error came along:
$result=`lighttpd -f /etc/lighttp.conf 2>&1`; if ( $result =~ m/going down/ ) { $RetVal=0; } else { $RetVal=1; } return $RetVal;
This code hangs if the startup of lighttpd succeeds. It is visible in the process list that the lighttpd started by the code has gone defunct:br
root@san-radio-1:~# ps -axfbr
2555 ? Ss 0:00 \_ sshd: root@pts/2br
2557 pts/2 Ss 0:00 | \_ -bashbr
2733 pts/2 S+ 0:00 | \_ /usr/bin/perl -w /etc-ro/rc.d/lighttpd.pl startbr
2734 pts/2 Z+ 0:00 | \_ lighttpd <defunct>br
2736 ? S 0:00 /usr/sbin/lighttpd -f /etc/lighttpd.confbr
2737 ? Ss 0:00 \_ /usr/bin/php-cgibr
br
When checking filedescriptors it becomes clear that the perl script has an open filedescriptor on the backtick construct. The defunct process does not show any open fd's
I haven't looked at the code, but it appears to me as an ordering problem in closing the filehandles and sending a signal.
-- mpo
Updated by gstrauss over 8 years ago
- Description updated (diff)
- Status changed from New to Fixed
- Assignee deleted (
jan) - Target version changed from 1.5.0 to 1.4.40
In lighttpd 1.4.40, proper exit value (if there is an error at startup) is propagated to parent process which starts daemon
Also available in: Atom