[MacPorts] #54193: squid3+launchd causes multiple runaway processes when run in daemon mode
MacPorts
noreply at macports.org
Thu May 18 21:58:59 UTC 2017
#54193: squid3+launchd causes multiple runaway processes when run in daemon mode
-----------------------+--------------------
Reporter: essandess | Owner:
Type: defect | Status: new
Priority: High | Milestone:
Component: ports | Version: 2.4.1
Keywords: | Port: squid3
-----------------------+--------------------
{{{
sudo port load squid3
}}}
regularly and consistently causes multiple runaway squid process with 100
percent cpu. The problem is severe enough to crash a squid server. I
observe this problem, as do others here:
https://github.com/essandess/osxfortress/issues/5#issuecomment-292507167
and elsewhere.
This happens after a network interface is changed, or some other change in
dis or the network. The only fix is to kill everything:
{{{
sudo port unload squid3
sudo killall -9 squid
sudo killall -9 '(squid-1)'
}}}
This problem is caused because the file
{{{/opt/local/etc/LaunchDaemons/org.macports.Squid/Squid.wrapper}}}
specifies that squid is launched in daemon mode, which confuses launchd.
This is a long standing issue between launchd and Macports squid. It is
The confirmed fix is to launch squid in non-daemon mode by adding the
{{{-N}}} flag to the wrapper's {{{Start()}}} method.
Here is the corrected, working {{{Squid.wrapper}}} file:
{{{
#!/bin/sh
#
# MacPorts generated daemondo support script
#
#
# Init
#
prefix=/opt/local
#
# Start
#
Start()
{
cd /opt/local/var/squid
if [ ! -d "/opt/local/var/squid/cache/00" ]; then
/opt/local/sbin/squid -s -z
fi
/opt/local/sbin/squid -s -N
}
#
# Stop
#
Stop()
{
cd /opt/local/var/squid
/opt/local/sbin/squid -k shutdown
while /opt/local/sbin/squid -k check; do
sleep 1
done
}
#
# Restart
#
Restart()
{
Stop
Start
}
#
# Run
#
Run()
{
case $1 in
start ) Start ;;
stop ) Stop ;;
restart) Restart ;;
* ) echo "$0: unknown argument: $1";;
esac
}
#
# Run a phase based on the selector
#
Run $1
}}}
--
Ticket URL: <https://trac.macports.org/ticket/54193>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list