RE: [squid-users] starting squid and bind error makes no sence

From: Andreas Piesk <apiesk@dont-contact.us>
Date: Thu, 6 Sep 2001 08:24:59 +0200

> From: plendon@microelectronics.com
> [mailto:plendon@microelectronics.com]
> Sent: Wednesday, September 05, 2001 9:58 PM
>
> Hi all,
>
> I've read the faq and all archives with "bind".
>
> Previously we were running Squid 2.3.STABLE4 and have since updgraded
> all RedHat 6.2 systems to 2.4.STABLE2.
> I was hoping the new version and patch for kill-parent-hack would
> resolve problem.
> It appears the patch is unrelated to my problem.
>
> Each night squids are shutdown with /usr/local/squid/bin/squid -k
> shutdown.
> Each morning at 6:00am squids are restarted with
> /usr/local/squid/bin/squid.
> Sometimes users can not access caches.
>
> For instance:
> Last night one squid was shutdown.
> I checked the system log and saw that:
> squid[18988]: Squid Parent: child process 18990 exited
> with status
> 0
> This morning the squid was started at 6:00am with
> /usr/local/squid/bin/squid.
> I checked the system log and saw that:
> Sept 5 06:00:00 squid[24036]: Squid Parent: child process 24038
> started
> However, this morning users could not access that particular cache.
> I looked at the cache.log and found:
> commBind: Cannot bind socket FD 16 to *:3128 (98) Address
> already in
> use.
> So, at 9:46 the command /usr/local/squid/bin/squid was
> retyped and users
> could then access cache.
> Note, I did not have to kill any processes or find out if another
> process was using port 3128, I simply ran /usr/local/squid/bin/squid.
> ps -ef |grep squid displays:
> root 24036 1 0 06:00 ?
> 00:00:00
> /usr/local/squid/bin/squid
> squid 24038 24036 0 06:00 ?
> 00:01:49 (squid)
>
> squid 24044 24038 0 06:00 ? 00:00:00
> (unlinkd)
> squid 24721 24038 0 09:46 ? 00:00:00
> (ncsa_auth) /usr/local/squid/etc
> squid 24722 24038 0 09:46 ? 00:00:00
> (ncsa_auth) /usr/local/squid/etc
> squid 24723 24038 0 09:46 ? 00:00:00
> (ncsa_auth) /usr/local/squid/etc
> squid 24724 24038 0 09:46 ? 00:00:00
> (ncsa_auth) /usr/local/squid/etc
> squid 24725 24038 0 09:46 ? 00:00:00
> (ncsa_auth) /usr/local/squid/etc
> root 26190 25975 0 15:46 pts/5 00:00:00 grep
> squid
>
> I know the log says port 3128 was already in use, but it appears squid
> had the port already.
> >From above, squid was started at 6:00, but port was in use.
> Then, squid
> was started again at 9:46.
> All we do is run the command /usr/local/squid/bin/squid a second time
> and all is well.
>
> What is happening?
>
> How can I resolve problem so that Squids work the first time
> /usr/local/squid/bin/squid is ran?
>
> Any ideas would be greatly appreciated, as we have 19 systems running
> squid and this happens frequently.
>

are you sure that squid was really down ? i suggest using a rc-script,
something like that:

squid -k shutdown
if [ $? -eq 0 ] ; then
  # give squid ${SQUID_SHUTDOWN_TIMEOUT} sec to die
  while squid_alive; do
    sleep 1
    SQUID_SHUTDOWN_TIMEOUT=$[${SQUID_SHUTDOWN_TIMEOUT}-1]
  done

  # squid is still alive -> the hard way
  if squid_alive; then
    kill -TERM ${PID}
  fi
fi

works perfectly for me (but usually we don't restart the caches :)
btw, why do you restart your squids ?

ciao -ap

System Administration
VIRBUS AG
Fon +49(0)341-979-7424
Fax +49(0)341-979-7409
andreas.piesk@virbus.de
www.virbus.de
Received on Thu Sep 06 2001 - 00:25:03 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:02:03 MST