Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@kirs
Copy link

@kirs kirs commented Sep 7, 2020

The current implementation of const_missing is not thread safe and it triggers exceptions like:

NoMethodError: undefined method `implementation' for HTTP::CookieJar::AbstractStore:Class
  /app/data/bundler/ruby/2.6.0/gems/http-cookie-1.0.3/lib/http/cookie_jar.rb:38:in `get_impl'
  /app/data/bundler/ruby/2.6.0/gems/http-cookie-1.0.3/lib/http/cookie_jar.rb:74:in `initialize'
  /app/data/bundler/ruby/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:339:in `new'
  /app/data/bundler/ruby/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:339:in `process_cookie_args!'
  /app/data/bundler/ruby/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:86:in `initialize'
  /app/data/bundler/ruby/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:63:in `new'
  /app/data/bundler/ruby/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:63:in `execute'
  /app/data/bundler/ruby/2.6.0/gems/rest-client-2.1.0/lib/restclient/resource.rb:51:in `get'

I tried to make that const_missing thread safe by using a mutex but I don't think it's possible because of circular dependencies.

A colleague of mine suggested that I leverage autoload which is thread safe.

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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.