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

Infinite loop with httpx 1.4.0+, webmock and vcr #77

Open
jaynetics opened this issue Feb 26, 2025 · 0 comments
Open

Infinite loop with httpx 1.4.0+, webmock and vcr #77

jaynetics opened this issue Feb 26, 2025 · 0 comments

Comments

@jaynetics
Copy link

jaynetics commented Feb 26, 2025

When using webmock and vcr, httpx v1.4.0+ hangs or goes into an infinite loop if there is no matching cassette.

Maybe VCR::Errors::UnhandledHTTPRequestError is swallowed now?

The problem does not happen with earlier versions of httpx.

This is the control flow that loops / repeats indefinitely:

/gems/httpx-1.4.1/lib/httpx/selector.rb:169
/gems/httpx-1.4.1/lib/httpx/selector.rb:173
/gems/httpx-1.4.1/lib/httpx/selector.rb:38
/gems/httpx-1.4.1/lib/httpx/timers.rb:41
/gems/httpx-1.4.1/lib/httpx/timers.rb:42
/gems/httpx-1.4.1/lib/httpx/session.rb:228
/gems/httpx-1.4.1/lib/httpx/session.rb:320
/gems/httpx-1.4.1/lib/httpx/selector.rb:29
/gems/httpx-1.4.1/lib/httpx/selector.rb:30
/gems/httpx-1.4.1/lib/httpx/selector.rb:190
/gems/httpx-1.4.1/lib/httpx/timers.rb:33
/gems/httpx-1.4.1/lib/httpx/connection.rb:311
/gems/httpx-1.4.1/lib/httpx/connection.rb:313
/gems/httpx-1.4.1/lib/httpx/selector.rb:31
/gems/httpx-1.4.1/lib/httpx/selector.rb:37
/gems/httpx-1.4.1/lib/httpx/selector.rb:115
/gems/httpx-1.4.1/lib/httpx/selector.rb:117
/gems/httpx-1.4.1/lib/httpx/selector.rb:163
/gems/httpx-1.4.1/lib/httpx/selector.rb:165
/gems/httpx-1.4.1/lib/httpx/selector.rb:167
/gems/httpx-1.4.1/lib/httpx/adapters/webmock.rb:102

Here is a minimal reproduction (warning, this may block your terminal):

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'httpx', '~> 1.4'
  gem 'webmock', '~> 3.25'
  gem 'vcr', '~> 6.3'
  gem 'tracer', '~> 0.2.3'
end

require 'httpx/adapters/webmock'

VCR.configure do |config|
  config.hook_into :webmock
  config.allow_http_connections_when_no_cassette = false
end

LineTracer.new.start
HTTPX.get('http://example.com')
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

No branches or pull requests

1 participant