httpd randomly gives error 408

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

httpd randomly gives error 408

Hidvégi Gábor
 >Synopsis: httpd randomly gives error 408
 >Category: httpd
 >Environment:
         System      : OpenBSD 6.2
         Details     : OpenBSD 6.2 (GENERIC) #132: Tue Oct  3 21:18:21 MDT 2017

[hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC

         Architecture: OpenBSD.amd64
         Machine     : amd64
 >Description:

httpd sometimes responds errordocument 408 on a random request

 >How-To-Repeat:

This bug is common, not amd64 only, can be reproduced on armv7 as well. All you need to do is to
open index.html in the browser (tried with Internet Explorer, Firefox and Chrome) and keep pressing
F5 (refresh) many times. When you look at the access.log, you randomly see lines like this one:

OpenBSD teszt 192.168.0.19 - - [12/Jan/2018:16:59:16 +0100] "<UNKNOWN> " 408 0

httpd.conf:
default type text/html
prefork 2

server "OpenBSD teszt" {
   listen on egress port 80
   directory no auto index
}

types {
   text/html  html
}



 >Fix:

check httpd source

Gábor Hidvégi


Reply | Threaded
Open this post in threaded view
|

Re: httpd randomly gives error 408

Hiltjo Posthuma
On Fri, Jan 12, 2018 at 05:15:24PM +0100, Hidvégi Gábor wrote:

> >Synopsis: httpd randomly gives error 408
> >Category: httpd
> >Environment:
>         System      : OpenBSD 6.2
>         Details     : OpenBSD 6.2 (GENERIC) #132: Tue Oct  3 21:18:21 MDT 2017
>
> [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC
>
>         Architecture: OpenBSD.amd64
>         Machine     : amd64
> >Description:
>
> httpd sometimes responds errordocument 408 on a random request
>
> >How-To-Repeat:
>
> This bug is common, not amd64 only, can be reproduced on armv7 as well. All
> you need to do is to open index.html in the browser (tried with Internet
> Explorer, Firefox and Chrome) and keep pressing F5 (refresh) many times.
> When you look at the access.log, you randomly see lines like this one:
>
> OpenBSD teszt 192.168.0.19 - - [12/Jan/2018:16:59:16 +0100] "<UNKNOWN> " 408 0
>
> httpd.conf:
> default type text/html
> prefork 2
>
> server "OpenBSD teszt" {
>   listen on egress port 80
>   directory no auto index
> }
>
> types {
>   text/html  html
> }
>
>
>
> >Fix:
>
> check httpd source
>
> Gábor Hidvégi
>
>

Hey,

I can also reproduce it on -current and firefox-esr. It is related to the
timeout handling, but I don't know a fix yet.

A faster way to reproduce it is to add to httpd.conf:

server "*" {
        connection {
                request timeout 5
        }
        ...
}

Then do a single request (no need to spam it) and wait 5 seconds.
Then (when run with httpd -d -vv) a line appears:

        server *, client 1 (1 active), 127.0.0.1:43314 -> 127.0.0.1:6970, timeout (408 Request Timeout)

--
Kind regards,
Hiltjo

Reply | Threaded
Open this post in threaded view
|

Re: httpd randomly gives error 408

Hiltjo Posthuma
On Mon, Jan 15, 2018 at 12:15:48PM +0100, Hidvégi Gábor wrote:

> Hello there,
>
> if you look at the access log, you can notice that the shadow request is
> exactly one minute after a real query, like:
>
> OpenBSD teszt 192.168.255.1 - - [12/Jan/2018:16:16:42 +0100] "GET / HTTP/1.1" 200 5
> OpenBSD teszt 192.168.255.1 - - [12/Jan/2018:16:17:42 +0100] "<UNKNOWN> " 408 0
>
> or
>
> OpenBSD teszt 192.168.255.1 - - [12/Jan/2018:20:22:46 +0100] "GET / HTTP/1.1" 200 5
> OpenBSD teszt 192.168.255.1 - - [12/Jan/2018:20:23:46 +0100] "<UNKNOWN> " 408 0
>
> It might be a timeout or a second request started in the background.
>
> Gábor Hidvégi
>

I think this is because the default timeout in httpd is 1 minute:

"
request timeout seconds
                     Specify the inactivity timeout for HTTP operations
                     between client and server, for example the maximum time
                     to wait for a request from the client.  The default
                     timeout is 60 seconds (1 minute).  The maximum is
                     2147483647 seconds (68 years).
"

Can you try to change this as described below?

>
> Hiltjo Posthuma wrote:
> > On Fri, Jan 12, 2018 at 05:15:24PM +0100, Hidvégi Gábor wrote:
> >
> > > > Synopsis: httpd randomly gives error 408
> > > > Category: httpd
> > > > Environment:
> > >
> > >        System      : OpenBSD 6.2
> > >        Details     : OpenBSD 6.2 (GENERIC) #132: Tue Oct  3 21:18:21 MDT 2017
> > >
> > > [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC
> > >
> > >        Architecture: OpenBSD.amd64
> > >        Machine     : amd64
> > >
> > > > Description:
> > >
> > > httpd sometimes responds errordocument 408 on a random request
> > >
> > >
> > > > How-To-Repeat:
> > >
> > > This bug is common, not amd64 only, can be reproduced on armv7 as well. All
> > > you need to do is to open index.html in the browser (tried with Internet
> > > Explorer, Firefox and Chrome) and keep pressing F5 (refresh) many times.
> > > When you look at the access.log, you randomly see lines like this one:
> > >
> > > OpenBSD teszt 192.168.0.19 - - [12/Jan/2018:16:59:16 +0100] "<UNKNOWN> " 408 0
> > >
> > > httpd.conf:
> > > default type text/html
> > > prefork 2
> > >
> > > server "OpenBSD teszt" {
> > >  listen on egress port 80
> > >  directory no auto index
> > > }
> > >
> > > types {
> > >  text/html  html
> > > }
> > >
> > >
> > >
> > >
> > > > Fix:
> > >
> > > check httpd source
> > >
> > > Gábor Hidvégi
> > >
> > >
> >
> >
> > Hey,
> >
> > I can also reproduce it on -current and firefox-esr. It is related to the
> > timeout handling, but I don't know a fix yet.
> >
> > A faster way to reproduce it is to add to httpd.conf:
> >
> > server "*" {
> > connection {
> > request timeout 5
> > }
> > ...
> > }
> >
> > Then do a single request (no need to spam it) and wait 5 seconds.
> > Then (when run with httpd -d -vv) a line appears:
> >
> > server *, client 1 (1 active), 127.0.0.1:43314 -> 127.0.0.1:6970, timeout (408 Request Timeout)
> >

--
Kind regards,
Hiltjo