Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#26270 - [lighttpd] needs a stale pid check

Attached to Project: Arch Linux
Opened by John (graysky) - Wednesday, 05 October 2011, 07:25 GMT
Last edited by Tom Gundersen (tomegun) - Saturday, 03 November 2012, 18:38 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Lighttpd stopped working all of a sudden. I removed it, nuked /etc/lighttpd/lighttpd.conf and re-installed lighttpd and using the default /etc/lighttpd/lighttpd.conf from the PKG with no modifications. When I attempt to start it, I got the FAIL message and nothing in /var/log/lighttpd at all (empty directory).

# rc.d start lighttpd
:: Checking configuration [DONE]
:: Starting lighttpd [FAIL]

That said, I can manually run the following and the daemon works just fine:

# /usr/sbin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf

As I inspected /etc/rc.d/lighttpd, it turns out that there was a stale pid file ---> /var/run/lighttpd/lighttpd-angel.pid for some reason preventing the daemon from running. Perhaps we need to add a stale pid check to /etc/rc.d/lighttpd/
This task depends upon

Closed by  Tom Gundersen (tomegun)
Saturday, 03 November 2012, 18:38 GMT
Reason for closing:  None
Additional comments about closing:  no longer an issue under systemd
Comment by Pontus Melke (OMGitsUGOD) - Wednesday, 21 December 2011, 08:16 GMT
This bit me too. It also doesn't remove it self from the list of daemons, thus running rc.d list shows lighttpd as "STARTED" even though it has crashed. To get it to start you have to remove both /run/lighttpd/lighttpd-angel.pid file and /run/daemon/lighttpd

Couldn't you use the get_pid function that is provided in /etc/rc.d/functions - which simply use pidof - instead of saving the pid to file.
Simply removing the get_pid function at the top of /etc/rc.d/lighttpd seems to work for me, but I can by no stretch say that I have properly tested it. This doesn't however address the issue of autoremoving lighttpd from /run/daemons but this might not even be an issue.

[EDIT]
I misunderstood how the light-angel worked, the patch I submitted doesn't work, please disregard.
Submit a patch here if you're interested.
[EDIT 2]
Something like:

get_pid() {
local pid
local name
pid=$(cat $pid_file 2>> /dev/null)
if [ -n "$pid" ]; then
name=$(ps -p $pid -o comm= 2> /dev/null);
if [ -z "$name" ]; then
rm -f $pid_file
pid=""
fi
else
pid=$(pgrep -f /usr/sbin/lighttpd-angel)
fi
echo $pid
}

probably works. I'm sure there are better way of fixing this and I'm still not certain why it's necessary to store the pid in a file instead of using 'pidof'.



Loading...