Re: Server Timeout not working?

From: Ulric Eriksson (ulric@siag.nu)
Date: Mon Jun 03 2002 - 21:55:33 CEST


On Thu, 30 May 2002, Sean Cross wrote:

> However, I do have one (two) *minor* quirk/feature/bug/anomaly that I am
> curious about:
> Our IIS server is having problems (go figure.) Sometimes, it will go into
> a state where TCP connections are accepted, but no data is actually
> transferred. This is a bad thing. Worse off, it causes Pen to simply hang
> whenever a system wants to connect to that particular machine. What can I
> do about this?
>
> The second problem (and this would be the icing on the cake,) is that
> sometimes one of the servers will go "down". By "down", I mean that it
> generates nothing but "HTTP 500" error messages. How difficult would it be
> for you (or even me, I haven't looked at the codebase yet) to add support
> for "If on port 80, and we're dealing with HTTP traffic, and we get a
> 500-error, consider this machine down"?

Since pen doesn't know or care about application-level protocols such as
HTTP or SMTP, there is no way to distinguish a hung connection from one
which is simply idle. And when probing servers, any response is
acceptable, even error messages.

That's how it should be. It is best to put the protocol specifics into a
separate program.

Below is a small script I wrote on the way to work this morning. It uses
the text-only web browser Lynx to probe the web servers. It checks that it
can connect, that it gets a 200 status and that the returned text looks
right. If anything is wrong, the server is blacklisted for 5 minutes.

Some assembly required. And the script hasn't really been tested.

Ulric

8<---
#!/bin/sh

# Invoke as testurl URL CONTENT
testurl()
{
        rm -f webup.txt webup.err
        if lynx -dump -error_file=webup.err "$1" > webup.txt 2> /dev/null; then
                if test -f webup.txt -a -f webup.err; then
                        if grep '^STATUS.*200' webup.err > /dev/null 2>&1; then
                                if grep "$2" webup.txt > /dev/null 2>&1; then
                                        echo Success
                                else
                                        echo Wrong content
                                fi
                        else
                                echo Wrong status
                        fi
                else
                        echo Missing files
                fi
        else
                echo Error connecting
        fi
}

mytest()
{
        x=`testurl "$1" "$2"`
        if test "$x" != "Success"; then
                penctl localhost:8888 server "$3" blacklist 300
        fi
}

while :; do
        mytest http://server1:8080/index.html "If you can see this" 0
        mytest http://server2:8080/index.html "If you can see this" 1
        mytest http://server3:8080/index.html "If you can see this" 2
        sleep 60
done

8<---



This archive was generated by hypermail 2.1.2 : Mon Jun 03 2002 - 21:55:51 CEST