1

The squid (2.7) proxy that I have running on ubuntu 8.10 stops accepting new requests after being online for a while, due to reasons that I can't discover. However doing a squid -k reconfigure resolves the problem immediately.

Now I manually run this command by monitoring the log and if i don't see any activity for 5 minutes I reload the config.

Now on my quest for a solution I had several ideas:

  1. diagnose the root cause and eliminate it
  2. setup a script to automatically reload script if no new entries in access.log for the past 3 minutes
  3. painstakingly upgrade server to newer ubuntu version while keeping network offline or during off hours to minimize downtime.

I turn to you for solutions to option 2), as I do not understand squid enough for 1), and I'm avoiding 3) as long as i can. Any ideas?

6
  • When the problem occurs are there any related messages in the sqiud logs in /var/log/squid ?
    – user9517
    Jan 31, 2011 at 12:11
  • I have checked the logs but I don't find anything strange in cache.log or access.log, squid says that it's still waiting for requests... that's why I gave up on option 1)
    – Vijay
    Feb 1, 2011 at 4:07
  • > ubuntu 8.10 ? The first thing I'd suggest is update. (But this might be not in corellation.) > The squid (2.7) 2.7.what? Have tried 3.1? (Again, not 100 % corellated) > accepting new requests after being online for a while What do you mean "being online for a while"? How the cycle does exactly look like (power_on, squid_works_ok, squid_fails, squid_restart)?
    – poige
    Feb 1, 2011 at 11:09
  • yes exactly what you said.
    – Vijay
    Feb 1, 2011 at 11:09
  • ok, squid restarted, then what?
    – poige
    Feb 1, 2011 at 11:09

2 Answers 2

1

I've come across a similar behaviour in squid (this was about 5 years ago - never got to the bottom of it) but in my case it would start slowing down after being up for 2-3 days.

Something like this run from cron should give the required behaviour for it locking up completely (assuming it stops writing to the log files):

 #!/bin/bash

 LOGFILE=/var/log/cache.log
 # you may need to change the above to point to your logfile
 LASTRUN=/var/local/squidcheck
 # above can be whatever - but dir must exist

 if [ ! -f ${LASTRUN} ] ; then
      touch ${LASTRUN}
 fi
 if [ ${LASTRUN} -nt ${LOGFILE} ] ; then
       /usr/sbin/squid -k reload
 fi
 touch ${LASTRUN}

This needs to run as root - so either in the root crontab, or the system crontab...

 */5 * * * * /path/to/shellscript

(note you should not edit the crontab file in place - use crontab -l >copy_ctb to get a copy of the current crontab, edit it, then load the new config using crontab copy_ctb)

1
  • Ok I am using your idea, though I'd made a mistake in the command I'd mentioned earlier. I used -k reconfigure not reload. I assume the /5 in cron is for check every 5 minutes?
    – Vijay
    Feb 1, 2011 at 11:19
1

For test use wget and http_proxy

http_proxy="http://127.0.0.1:3128" wget http://ya.ru -O /dev/null

For restart:

http_proxy="http://127.0.0.1:3128" wget http://ya.ru -O /dev/null || squid -k reload
1
  • So I could do this with the crontab entry above thereby resulting in a check and fix soltuion?
    – Vijay
    Feb 1, 2011 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .