Reply To: Unable to stop mt-daapd 0.2.4 with daemontools

#5078
rpedde
Participant

@marlowe wrote:

All,

I installed mt-daapd 0.2.4 stable on an iMac running Yellow Dog Linux 4.1. I am able start the service using the RedHat start script with the following modification: added /usr/local/sbin to PATH in /etc/init.d/functions.

I would like to run mt-daapd out of DJB’s daemontools (http://cr.yp.to/daemontools.html). I have been able to successfully start mt-daapd from daemontools with the following run script

#!/bin/sh
exec 2>&1
mt-daapd -f

However when I attempt to stop the service with the following command:

svc -d /service/mt-daapd

the service does not stop. I have sent the assortment of signals listed here (http://cr.yp.to/daemontools/svc.html) and the service does not stop. I reviewed the Red Hat init.d script and noticed the stop portion says to send an INT signal to mt-daapd to stop it. However, the comments in the script state that this broken.

Can someone please point me to some material which explains which signals to send to mt-daapd to shut it down?

Thanks,
Patrick

The problem is that the thread that is the foreground thread isn’t the thread that handles signals. When it runs, the parent thread spawns a web server thread, a signal handling thread, and forks a mdns process. Then it waits for a quit event, which gets handled by the signal thread.

The problem is that the signals don’t seem to work the way that pthreads *say* they are supposed to on all applications. I’ve got some thoughts on fixing this, but not for 0.2.4, and I don’t really see a way to fix 0.2.4 to work, particularly when we’re thiiiiiis close to a new stable.

If you want to start working from nightlies, I can try to add the functionality you are looking for.

— Ron