[MacPorts] #54193: squid3+launchd causes multiple runaway processes when run in daemon mode
MacPorts
noreply at macports.org
Fri Jan 19 11:54:24 UTC 2018
#54193: squid3+launchd causes multiple runaway processes when run in daemon mode
------------------------+----------------------
Reporter: essandess | Owner: jmroot
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.4.1
Resolution: | Keywords:
Port: squid3 |
------------------------+----------------------
Comment (by essandess):
Re: https://github.com/essandess/macOS-
Fortress/issues/5#issuecomment-300650444 [`Squid.wrapper` with a `-N`
flag.]
I’ve made a few changes that I believe mitigate the problem of squid
running multiple processes at boot, but do not address the underlying
issue.
* Changed {{{squid.conf}}}’s {{{shutdown_lifetime 5 seconds}}} to be much
less than {{{daemondo}}}’s 20 second timeout to avoid {{{daemondo}}}
launching multiple redundant squid processes at boot or on a network
change. See
https://trac.macports.org/browser/branches/release_2_3/base/src/programs/daemondo/main.c:
> `const CFTimeInterval kChildDeathTimeout = 20.0;`
* Use a robust script [https://github.com/essandess/macOS-
Fortress/blob/master/macosfortress_boot_check] to run by hand at boot time
that checks (1) if squid has bound port 3128 and (2) that there is only a
single squid process. If not, it kills all running squid and relaunches a
controlled squid daemon. 🦑
{{{
# commands
SUDO=/usr/bin/sudo
PORT=/opt/local/bin/port
TAIL=/usr/bin/tail
LSOF=/usr/sbin/lsof
KILLALL=/usr/bin/killall
# squid
# make sure there aren't multiple squid jobs running
if ! [[ `$SUDO $LSOF -i ':3128' | $TAIL -1` && `ps -ef | grep
"/opt/local/sbin/squid -s" | grep -v grep | wc -l` -eq 1 ]]; then
$SUDO $PORT unload squid3
$SUDO $KILLALL 'squid'
$SUDO $KILLALL '(squid-1)'
$SUDO $PORT load squid3
fi
}}}
* Deprecated the modified `Squid.wrapper` file and use the default
Macports daemondo settings.
This has helped on the boxes I run, but doesn’t address the underlying
issue of `daemondo` launching multiple squid processes at boot or on a
network change.
--
Ticket URL: <https://trac.macports.org/ticket/54193#comment:16>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list