Skip to content

Conversation

@carlhoerberg
Copy link

Some clients (wget) resets the TCP connection when 404 is received, webrick then logs:

::1 - - [18/Jan/2022:12:41:41 CET] "GET /404 HTTP/1.1" 404 7173
- -> /404
[2022-01-18 12:41:41] ERROR Errno::ECONNRESET: Connection reset by peer @ io_fillbuf - fd:9
        /home/carl/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/webrick-1.7.0/lib/webrick/httpserver.rb:82:in `eof?'
        /home/carl/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/webrick-1.7.0/lib/webrick/httpserver.rb:82:in `run'
        /home/carl/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/webrick-1.7.0/lib/webrick/server.rb:310:in `block in start_thread'

Screenshot from 2022-01-18 12-43-23

@olleolleolle
Copy link
Contributor

@carlhoerberg Is there a chance of adding a test for this? https://github.com/ruby/webrick/blob/master/test/webrick/test_cgi.rb - perhaps there?

@tisba
Copy link

tisba commented Nov 10, 2024

I don't see how this change can have any impact on the backtrace from the PR description. The PR changes WEBrick::CGI::Socket#eof? but the trace indicates that WEBrick::HTTPServer is used and causing the error.

Also: I also cannot reproduce this behavior with wget.

However, I also see this error from time to time, I think when using Safari, but not 100% sure when this happens exactly. In any case WEBrick::HTTPServer#run does have an issue when the connection is reset. Testing this is a little tricky and there are multiple ways to address this. Will send a PR when I have poked around a little more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants