Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Strange, recurring squid issue
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
eXess
Apprentice
Apprentice


Joined: 17 Aug 2003
Posts: 243
Location: Belgium

PostPosted: Sun Jan 23, 2005 1:08 pm    Post subject: Strange, recurring squid issue Reply with quote

Hi all,

I've got this strange problem with my SQUID installation. Basically, it doesn't work. Apart from configuration files issues (I'm working on that) I noticed that I always get this error :
Code:
# /etc/init.d/squid restart
 * Stopping squid...
 * Waiting ............................................................. * Failed. [ !! ]
                                                                          [ ok ]
 * Starting squid...
2005/01/23 14:00:32| Squid is already running!  Process ID 11021          [ ok ]

And it seems really strange. Killing process 11021 (pid changes everytime of course) allows to restart, but I still got a very long "Waiting" prompt (altough it worked this time)... Strange uh? I'd like to sort this out prior to strafing through the config files. Actually this problem arose during an emerge -u and was simultaneous to the malfunction of Squid. And my config files have not changed, so I guess there's something else...
_________________
. . . . . . . .
eXess
Back to top
View user's profile Send private message
eXess
Apprentice
Apprentice


Joined: 17 Aug 2003
Posts: 243
Location: Belgium

PostPosted: Sun Jan 23, 2005 1:16 pm    Post subject: Reply with quote

[UPDATE]

After killing and restarting Squid, and checking through the config files, it seems that now it's working again! Strangest thing. So from now on, the only problem left is slow restart. This can be considered as non critical. However, if you ever have a clue on this... ;)
_________________
. . . . . . . .
eXess
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Sun Jan 23, 2005 1:19 pm    Post subject: Reply with quote

If the initscripts did not properly stop Squid at one time or another, there will still be a link to the initscript in /var/lib/init.d/started.
This is what causes the "squid already started" message.
Remove the link and try again.

The slow restart is definitely a configuration issue - which you admit you haven't actually figured out yet...
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
eXess
Apprentice
Apprentice


Joined: 17 Aug 2003
Posts: 243
Location: Belgium

PostPosted: Sun Jan 23, 2005 1:35 pm    Post subject: Reply with quote

I guess you are perfectly right adaptr. However, Squid config is quite complicated in the end. I could use some help here :) Has anyone any idea where the slow restart issue could come from ? Actually it's more accurate to say "slow stop" issue, cause starting causes no problem at all. And btw, I see that about everything is set to default in the config files... :s
_________________
. . . . . . . .
eXess
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Sun Jan 23, 2005 1:40 pm    Post subject: Reply with quote

Let's see.. it's been awhile since I configured it..
The most important config choices - away from the defaults - are your ACLs (obviously), network settings, memory settings (to keep it from running rampant) and any upstream caches.
Oh and your cache directories - spread them over multiple disks if you have any chance at all...
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
eXess
Apprentice
Apprentice


Joined: 17 Aug 2003
Posts: 243
Location: Belgium

PostPosted: Sun Jan 23, 2005 7:29 pm    Post subject: Reply with quote

I'll try to be short as well as precise, because I imagine posting all my config files would be rather inefficient.

- Memory settings are all default
- ACLs: All default except one supplement: one ACL set on "external auth", with one user in the list. In the restrictions, it is last but one, set on "allom".
- The user referenced in my ACL was defined in "/etc/webmin/squid/users", using Webmin Squis module.
- The "Basic authentication program" was defined as "/etc/webmin/squid/squid-auth.pl /etc/webmin/squid/users", number=5, cache time=2h, realm name changed of course, but the rest is default.
- Cache directory and all cache settings are default (cache is on /var/cache/squid) but I'm not using it as a cache, if necessary I can turn that off completely (if possible)...
- As far as I can see, everything else is default.

Note that I'm looking at the config through Webmin. If necessary, I can have a look directly in the config files...
_________________
. . . . . . . .
eXess
Back to top
View user's profile Send private message
andreac
n00b
n00b


Joined: 03 Aug 2004
Posts: 14
Location: Mergo

PostPosted: Thu Jan 27, 2005 12:38 pm    Post subject: Re: Strange, recurring squid issue Reply with quote

eXess wrote:
Hi all,

I've got this strange problem with my SQUID installation. Basically, it doesn't work. Apart from configuration files issues (I'm working on that) I noticed that I always get this error :
Code:
# /etc/init.d/squid restart
 * Stopping squid...
 * Waiting ............................................................. * Failed. [ !! ]
                                                                          [ ok ]
 * Starting squid...
2005/01/23 14:00:32| Squid is already running!  Process ID 11021          [ ok ]



Hi eXess,
same stop problem here. I use squid in a production server from last year, but in recent updates, the init script is unable to stop the daemon.
So I must manually kill the process then do:
Code:
/etc/init.d/squid zap
(wich reset to stopped state)
and then restart squid. :?:
_________________
Andrea
Back to top
View user's profile Send private message
tinwood
n00b
n00b


Joined: 05 Oct 2002
Posts: 36
Location: Newcastle upon Tyne, UK

PostPosted: Thu Jan 27, 2005 5:27 pm    Post subject: Reply with quote

Although it doesn't help, I likewise have the same stopping problem (not that I've worked out what is doing it).

Also, after today's update, http/1.1 doesn't appear to be working through the box .... sigh. :(
Back to top
View user's profile Send private message
DawgG
l33t
l33t


Joined: 17 Sep 2003
Posts: 874

PostPosted: Wed Feb 09, 2005 3:03 pm    Post subject: use SQUID-command directly Reply with quote

i'm not having any problems with the squid-init-scripts, but if they don't work for u u can always issue commands to squid directly (shutdown, interrupt and kill may be the most interesting in ur case). often that's better than stopping and re-starting the whole process (eg -k reconfigure).
the squid command-line opts can be found here:
http://www.squid-cache.org/Doc/FAQ/FAQ-3.html#ss3.8
helped me a lot.

EDIT: now i got problems, too

too bad, now i got the same problems you all mentioned.
it must have SOMETHING to do with the gentoo-initscripts which i think are rather strange:
- the starting-part tries to change settings that are already defined in the config-file (FDs)
when i start it "by hand"
Code:

squid -dDN

it just runs & serves after a couple of secs. with the init-script one cpu of the system was at 100% of load for some minutes (never-ever produced that much load before, and _I_ want to decide when or how to rebuild cachedirs or sth.) until i killed and restarted squid by hand.

-the stopping part somehow doesen't work right (gotta check EXACTLY how); it simply does not stop squid.
when i stop it with
Code:

squid -k shutdown (or kill)

it's down after 30 secs max.

i'll look into it some more (it's a "production" server) and maybe rewrite the initscripts.
Back to top
View user's profile Send private message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1227

PostPosted: Sun Apr 17, 2005 12:54 am    Post subject: Reply with quote

Same wait problem here.
Here's the stop part of the /etc/init.d/squid
Code:
stop() {
        ebegin "Stopping squid"
        PID=`cat /var/run/squid.pid 2>/dev/null`
        start-stop-daemon --stop --quiet --exec /usr/sbin/squid \
                --pidfile /var/run/squid.pid
        # Now we have to wait until squid has _really_ stopped.
        sleep 2
        if test -n "$PID" && kill -0 $PID 2>/dev/null
        then
                einfon "Waiting ."
                cnt=0
                while kill -0 $PID 2>/dev/null
                do
                        cnt=`expr $cnt + 1`
                        if [ $cnt -gt 60 ]
                        then
                                # Waited 120 seconds now. Fail.
                                eend 1 "Failed."
                                break
                        fi
                        sleep 2
                        echo -n "."
                done
                echo -n "done."
                eend 0
        else
                eend 0
        fi
}

Should we rewrite it something like (waiting for 40secs because default waiting for connection closing is 30secs):
Code:
stop() {
        ebegin "Stopping squid"
        squid -k shutdown
        # Now we have to wait until squid has _really_ stopped.
        sleep 2
        if test -n "$PID" && kill -0 $PID 2>/dev/null
        then
                einfon "Waiting ."
                cnt=0
                while kill -0 $PID 2>/dev/null
                do
                        cnt=`expr $cnt + 1`
                        if [ $cnt -gt 20 ]
                        then
                                # Waited 40 seconds now. Force!
                                squid -k kill
                                eend 1 "Killed."
                                break
                        fi
                        sleep 2
                        echo -n "."
                done
                echo -n "done."
                eend 0
        else
                eend 0
        fi
}

_________________
gentoo user
Back to top
View user's profile Send private message
jamapii
l33t
l33t


Joined: 16 Sep 2004
Posts: 637

PostPosted: Thu May 12, 2005 1:15 pm    Post subject: unstoppable squid Reply with quote

I have never seen any squid version+rc file from any distribution that works. At best, it works sometimes. I have used Suse 7.3 and Gentoo.

On Suse, I have modified the rc file to kill squid after some time. It worked finally. Usually I just do "killall squid", which can do collateral damage if someone calls their program squid.

The Gentoo rc file should be modified similarly.

I'm now trying it... looking at the rc file...

I wonder what's the reason. The PID may be wrong, or start-stop-daemon --stop doesn't work. Stopping squid fails only after it has been running for some time, so maybe it wants to do some stuff on exit that takes about forever.

I'm trying this modification to /etc/init.d/squid:

add this function before stop()
Code:
force_kill() {
        echo "trying harder"
        killall squid
        sleep 2
        while kill -0 $PID 2>/dev/null; do
            echo -n "."
            cnt=`expr $cnt + 1`
            [ $cnt -gt 65 ] && return 1
            sleep 2
        done
        return 0
}


make the "Failed" code conditional
Code:
                                # Waited 120 seconds now. Fail.
                                force_kill || eend 1 "Failed."
                                break


EDIT: fixed bugs
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum