Squid bug needs fixed - watchdog PHP script to monitor size of squid is broken
-
Using the following on our system:
.1-BETA0 (i386)
built on Fri Oct 26 18:02:00 EDT 2012
FreeBSD 8.3-RELEASE-p4
Multi-Wan Load Balancing Setup
Squid Proxy service is running.The watchdog PHP script which is supposed to monitor disk usage / disk percentage and the size of the squid cache tmp file is NOT working right. We believe the problem might be because the check_swapstate.php seems to miscalculating the size of the swapstate file but we are not certain.
–-----------------------------------------
The result is the hard drives fills up and squid crashes bringing down the internet with it. (Bypssing the proxy server does allow a user to temporarily get access to the internet, but my solution so far has been to delete the large swapstate file that was created and not deleted.)
further description follows...if anyone has advice please post a reply.
I have squid set to be 60GB in size. (I have a small hard drive)
The directory is using the following amount of space in /var/squid/cache:
1955288 ./00
1913004 ./01
3608162 ./02
2059640 ./03
1643160 ./04
2530112 ./05
2316560 ./06
3096342 ./07
1764184 ./08
2170994 ./09
1439058 ./0A
2577592 ./0B
1182504 ./0C
516 ./0D
516 ./0E
516 ./0F
95302534 .That includes a file that is 68G which is IN the directory and is named swap.state.
-rw-rw-rw- 1 proxy proxy 68619911152 Nov 27 01:06 swap.state
As noted, the /etc/crontab is supposed to running a swap state check every 15 minutes. This CAN'T be working right, as it should delete the swap.state file if it's using over 75% of the disk.
I ran the sections from THIS line in crontab
0 0 * * * root /bin/rm /var/squid/cache/swap.state; /usr/pbi/squid-i386/sbin/squid -k rotate
and had it delete and rotate.
But the line with
*/15 * * * * root /usr/local/pkg/swapstate_check.php
doesn't appear to be doing its job.
Can anyone please advice on how to fix this issue AND note to fix the package in a future release update.
Thanks, Phil Jansma
-
Can anyone please advice on how to fix this issue AND note to fix the package in a future release update.
Change squid binary path on swapstate_check.php and test again.
If you confirm that it works, I can push a fix for it. :)
-
Can anyone please advice on how to fix this issue AND note to fix the package in a future release update.
Change squid binary path on swapstate_check.php and test again.
If you confirm that it works, I can push a fix for it. :)
I'm helping on this issue and saw your response. Do you mean this line?
mwexec_bg("/bin/rm $swapstate; /usr/local/sbin/squid -k rotate");
What should it be changed TO? That seems to be a symlink to a file which does exist:
lrwxr-xr-x 1 root wheel 31 Oct 27 18:03 squid -> /usr/pbi/squid-i386/.sbin/squid
-rwxr-xr-x 1 root wheel 9329 Aug 12 09:50 /usr/pbi/squid-i386/.sbin/squid
Also, does this output look correct? This is what we get from running the php script by hand:
/usr/local/pkg/swapstate_check.php
cachedir is /var/squid/cache
file is /var/squid/cache/swap.state
s_s = 13415740
disktot is 107934111744
cachedir is running
swap is 0
disk is 27
state size is 13415740It just never seems to catch the fact that the file goes beyond the boundaries set for it.
-
The script generates an altert to system logs when swap is clean.
Do you have this alert on your system after manual script execution?
-
The script generates an altert to system logs when swap is clean.
Do you have this alert on your system after manual script execution?
After clearing the system log in the GUI and running the command by hand, this is all I have when I run strings and tail on the system.log:
Dec 10 22:19:42 gw syslogd: kernel boot file is /boot/kernel/kernel
Dec 10 22:19:58 gw syslogd: exiting on signal 15
Dec 10 22:19:58 gw syslogd: kernel boot file is /boot/kernel/kernel
Dec 10 22:20:15 gw syslogd: exiting on signal 15
Dec 10 22:20:15 gw syslogd: kernel boot file is /boot/kernel/kernel
Dec 10 22:20:41 gw check_reload_status: Syncing firewall
Dec 10 22:20:41 gw syslogd: exiting on signal 15
Dec 10 22:20:41 gw syslogd: kernel boot file is /boot/kernel/kernel
Dec 10 22:20:41 gw kernel: pflog0: promiscuous mode disabled
CLOGKeep in mind that I upgraded to the latest pfsense today as well. But I'm not getting ANY output on the screen as before.
-
The script generates an altert to system logs when swap is clean.
Do you have this alert on your system after manual script execution?
No further help on this so far.
I went to the swapstate_check.php file and manually edited it to say:
if (($swapstate_pct > 25) || (($diskusedpct > 90) && ($swapstate_size > 102410241024))) {
changing the 75 to 25. The swap.state file in /var/squid/cache is 29G. The total disk size is 100G. It is ALREADY over 25% of the disk space total. But when I ran it by hand, it did NOTHING. No output, no removing of the cache file, NOTHING.
Something is badly broken here.
Anyone who knows how to fix this?
-
Something is badly broken here.
Anyone who knows how to fix this?
echo $swapstate_pct $diskusedpct and $diskusedpct before the test to see what values it has…
-
Keeps crashing…am going to try a clean install and a larger HD and see if the bug goes away. Will report results when the 2TB drive is full. LOL
-
Keeps crashing…am going to try a clean install and a larger HD and see if the bug goes away. Will report results when the 2TB drive is full. LOL
what sizes do you have on these scripts vars when swapstate file is large????
echo "state: $swapstate_pct disk usage: $diskusedpct\n";
-
Keeps crashing…am going to try a clean install and a larger HD and see if the bug goes away. Will report results when the 2TB drive is full. LOL
UPDATE REPORT
Since a new install and a larger 2TB drive I have not had any more issues so if you get this symptom my guess it is most likely because your install was corrupted…so try a completely new install. -
Thanks for the feedback, this patch was applied to squid3 install.