Index: [Article Count Order] [Thread]

Date:  Thu, 21 Mar 2002 00:11:44 +0100 (MET)
From:  Lars Christensen <larsch@cs.auc.dk>
Subject:  [webricken:66] Re: Help with a 408 error
To:  webricken@notwork.org
Message-Id:  <Pine.GSO.4.44.0203202348590.12174-100000@peta.cs.auc.dk>
In-Reply-To:  <m2wuxet4di.fsf@zip.local.thomases.com>
X-Mail-Count: 00066

On 15 Feb 2002, Dave Thomas wrote:

> GOTO Kentaro <gotoken@notwork.org> writes:
>
> > That doesn't be reproduced on my Window ME box with
> > sample/httpd/htdocs/test.rhtml.  Could you show the rhtml or any example?
>
> More information... if I disable keep_alive? in HttpResponse, it all
> works perfectly. I'm not sure where to look next.

I have the same problem here under Linux with Mozilla. I get this:

[2002-03-20 22:34:42] INFO  127.0.0.1 "" 408 0 "-" "-"
[2002-03-20 22:34:42] DEBUG close: 127.0.0.1:33196
[2002-03-20 22:34:42] DEBUG accept: 127.0.0.1:33197

And sometimes this together with the 408:

[2002-03-20 22:34:42] ERROR Errno::ENOTCONN: Transport endpoint is not
connected - "getpeername(2)"
        /usr/lib/ruby/1.6/webrick/httpserver.rb:101:in `peeraddr'
        /usr/lib/ruby/1.6/webrick/httpserver.rb:101:in `access_log'
        /usr/lib/ruby/1.6/webrick/httpserver.rb:58:in `run'
        /usr/lib/ruby/1.6/webrick/server.rb:95:in `start'
        /usr/lib/ruby/1.6/webrick/server.rb:88:in `loop'
        /usr/lib/ruby/1.6/webrick/server.rb:88:in `start'
        /usr/lib/ruby/1.6/webrick/server.rb:85:in `start'
        /usr/lib/ruby/1.6/webrick/server.rb:85:in `start'
        /usr/lib/ruby/1.6/webrick/server.rb:84:in `times'
        /usr/lib/ruby/1.6/webrick/server.rb:84:in `start'
        /usr/lib/ruby/1.6/webrick/server.rb:77:in `start'
        /usr/lib/ruby/1.6/webrick/server.rb:77:in `start'
        ./rbjuke.rb:148

It seems to occur only when there are many request from the same client
and server has (too?) few threads. I can provoke the error with the
following script:

require 'webrick'
$count = 0
s = WEBrick::HTTPServer.new(:Port => 2001, :StartThreads => 1)
s.mount_proc("/") { |req,res|
  num = (req.query['num']||0).to_i
  body = "<html>"
  if num < 3
    body << "<frameset cols=\"*,*\" rows=\"*,*\">"
    4.times {
      body << "<frame src=\"/?num=#{num+1}&#{$count}\">"
      $count += 1
    }
    body << "</frameset>"
  else
    body << "<body>Hello</body>"
  end
  body << "</html>"
  res.body = body
}
trap("INT") { s.shutdown }
s.start


Adding res.keep_alive=false to the end of the block makes it work.

-- 
Lars Christensen, larsch@cs.auc.dk