# Can't stop Squid processes



## zigfrid (Mar 27, 2015)

Hello
I've installed Squid 3.4.12 from ports. It works fine, but I can't use /usr/local/etc/rc.d/squid to stop or restart it.
`/usr/local/etc/rc.d/squid stop` removes the pid file at /var/run but it doesn't stop processes:

```
root@mail:/usr/local/etc/rc.d # ./squid start
Starting squid.

root@mail:/usr/local/etc/rc.d # ps ax | grep squid
66331  -  Ss  0:00.00 /usr/local/sbin/squid -f /usr/local/etc/squid/squid.conf
66333  -  S  0:00.07 (squid-1) -f /usr/local/etc/squid/squid.conf (squid)
66335  -  S  0:00.02 (logfile-daemon) /var/log/squid/access.log (log_file_daemon)
66338  1  S+  0:00.00 grep squid

root@mail:/usr/local/etc/rc.d # ./squid stop
Stopping squid.
Waiting for PIDS: 66333.

root@mail:/usr/local/etc/rc.d # ps ax | grep squid
66331  -  Ss  0:00.00 /usr/local/sbin/squid -f /usr/local/etc/squid/squid.conf
66362  -  S  0:00.07 (squid-1) -f /usr/local/etc/squid/squid.conf (squid)
66363  -  S  0:00.02 (logfile-daemon) /var/log/squid/access.log (log_file_daemon)
66366  1  S+  0:00.00 grep squid
```

As you see the process's pid changed, but they didn't stop.
I can run `#killall squid` but it isn't right way.


----------



## obsigna (Mar 27, 2015)

This is a known issue, see PR195802. For fixing this issue, you have two options, either switch to FreeBSD 10.1-STABLE or patch the kernel, using the patch file attached to said bug report, then re-compile and re-install the kernel. I resolved my issue by patching and re-compiling the 10.1-RELEASE kernel.


----------



## getopt (Mar 27, 2015)

See man squid(8) for controlling squid:
Use `squid -k` for your tasks.


----------



## zigfrid (Mar 27, 2015)

getopt said:


> See man squid(8) for controlling squid:
> Use `squid -k` for your tasks.


`squid -k` doesn't work neither.


----------



## zigfrid (Mar 27, 2015)

obsigna said:


> This is a known issue, see PR195802. For fixing this issue, you have two options, either switch to FreeBSD 10.1-STABLE or patch the kernel, using the patch file attached to said bug report, then re-compile and re-install the kernel. I resolved my issue by patching and re-compiling the 10.1-RELEASE kernel.



Thank You very much!
Patch resolved my problem.


----------



## getopt (Mar 27, 2015)

Did you use `squid -k kill`? Here it works perfectly. All squid processes are gone.


----------



## obsigna (Mar 27, 2015)

getopt said:


> Did you use `squid -k kill`? Here it works perfectly. All squid processes are gone.


Are you talking about FreeBSD 10.1-RELEASE?

The issue with stopping www/squid (and other processes) is a signal handling problem and it was introduced into the FreeBSD kernel in the course from 10.0 to 10.1, and it has been fixed meanwhile for 10.1-STABLE. On a vanilla 10.1-RELEASE, when quitting squid, it thinks its child has crashed, and re-spawns a new child, so squid can't be stopped in a regular fashion on 10.1-RELEASE.


----------



## getopt (Mar 27, 2015)

obsigna said:


> Are you talking about FreeBSD 10.1-RELEASE?


Yes. Here no problems with Squid 3.4.12.


----------

