Ticket #1539 (new defect)
Opened 7 months ago
can't capture lighttpd startup notifications output in perl script
| Reported by: | mpo@… | Owned by: | jan |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.5.0 |
| Component: | core | Version: | 1.4.18 |
| Severity: | normal | Keywords: | |
| Cc: | Blocked By: | ||
| Need User Feedback: | no | Blocking: |
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:
root@san-radio-1:~# ps -axf
2555 ? Ss 0:00 \_ sshd: root@pts/2
2557 pts/2 Ss 0:00 | \_ -bash
2733 pts/2 S+ 0:00 | \_ /usr/bin/perl -w /etc-ro/rc.d/lighttpd.pl start
2734 pts/2 Z+ 0:00 | \_ [lighttpd] <defunct>
2736 ? S 0:00 /usr/sbin/lighttpd -f /etc/lighttpd.conf
2737 ? Ss 0:00 \_ /usr/bin/php-cgi
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.

