Skip to content

couldn't read response headers (HTTP::ConnectionError) #459

Open
@tycooon

Description

@tycooon

I get this error when using persistent connection with high keep_alive_timeout value.

Test script:

require "http"

url = "https://www.google.com/"
client = HTTP.persistent(url, timeout: 1000)

puts Time.now
puts client.get(url).to_s.size
sleep 5
puts client.get(url).to_s.size
sleep 240
puts client.get(url).to_s.size

This consistently gives me the following output:

15551
15594
Traceback (most recent call last):
	6: from tmp/test-http.rb:28:in `<main>'
	5: from /Users/tycooon/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/http-3.0.0/lib/http/chainable.rb:20:in `get'
	4: from /Users/tycooon/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/http-3.0.0/lib/http/client.rb:43:in `request'
	3: from /Users/tycooon/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/http-3.0.0/lib/http/client.rb:66:in `perform'
	2: from /Users/tycooon/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/http-3.0.0/lib/http/connection.rb:99:in `read_headers!'
	1: from /Users/tycooon/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/http-3.0.0/lib/http/connection.rb:99:in `loop'
/Users/tycooon/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/http-3.0.0/lib/http/connection.rb:101:in `block in read_headers!': couldn't read response headers (HTTP::ConnectionError)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions