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

Make httpclient_adapter threadsafe #909

Merged
merged 1 commit into from Oct 16, 2020
Merged

Commits on Oct 16, 2020

  1. Make httpclient_adapter threadsafe

    httpclient_adapter uses some standard Ruby hashes, which produce unexpected results when working in a true multi-threaded (e.g. JRuby) environment. Multiple threads doing puts and deletes on these hashes result in nils sometimes being returned for a properly stubbed request. These errors would manifest as:
    webmock-3.9.2/lib/webmock/http_lib_adapters/httpclient_adapter.rb:113:in `build_httpclient_response': undefined method `body' for nil:NilClass (NoMethodError)
    
    Unfortunately these errors are extremly difficult to replicate.
    
    This PR is a follow-on from bblimke#908, and represents the last thread-safety issue we've been able to find.
    Adam Harwood committed Oct 16, 2020
    Copy the full SHA
    cf3d1cf View commit details
    Browse the repository at this point in the history