Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch CONNRESET on eof? #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
Development

Successfully merging this pull request may close these issues.

3 participants