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

undefined method 'implementation' for HTTP::CookieJar::AbstractStore:Class #6

Open
maia opened this issue Jun 22, 2015 · 12 comments · May be fixed by #43
Open

undefined method 'implementation' for HTTP::CookieJar::AbstractStore:Class #6

maia opened this issue Jun 22, 2015 · 12 comments · May be fixed by #43

Comments

@maia
Copy link

maia commented Jun 22, 2015

I found the following error in my heroku logfiles:

NoMethodError: undefined method `implementation' for HTTP::CookieJar::AbstractStore:Class
/app/vendor/bundle/ruby/2.2.0/gems/http-cookie-1.0.2/lib/http/cookie_jar.rb:38:in `get_impl'
/app/vendor/bundle/ruby/2.2.0/gems/http-cookie-1.0.2/lib/http/cookie_jar.rb:74:in `initialize'
/app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:135:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:135:in `initialize'
/app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.3/lib/mechanize.rb:182:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.3/lib/mechanize.rb:182:in `initialize'

Unfortunately I did not log the uri that was queried by my rake task, and the problem did not occur in the following hours. I still hope it's enough info to find the culprit.

@carsonreinke
Copy link

I have received this error also, randomly.

@perlun
Copy link
Contributor

perlun commented Apr 7, 2017

I have also been seeing this appearing on Sentry. Unsure of what is triggering it.

@perlun
Copy link
Contributor

perlun commented Jul 17, 2017

I saw this in the logs again now. My suspicion is something related to bafb83f. We apparently auto-load these files, and in my case, the gem is being used from multiple threads concurrently - it could be a glitch in the gem or MRI related to the auto-loading.

@knu - would it be OK with you to skip the autoloading and require the abstract_store unconditionally instead? If so, I'll gladly submit a patch to hopefully solve this issue.

@JasonLunn
Copy link

We still see this issue today, in 1.0.3, on JRuby, so it doesn't appear to be MRI specific or limited to version 1.0.2 that was initially reported. Has anyone developed a workaround in the two years since this was filed?

@perlun
Copy link
Contributor

perlun commented Jul 31, 2017

@JasonLunn Not that I know of. I suspect that loading files late (when they are needed) have race conditions. So loading everything at once, on startup, could work - if you find a working strategy, please post the suggestions here so we can apply it (and hopefully submit a PR to the gem for it to get fixed properly).

@grosser
Copy link

grosser commented Aug 18, 2017

seeing the same ... updating to latest in hope that fixes anything ... was running the same app for months and after a restart this popped up ...

@perlun
Copy link
Contributor

perlun commented Sep 4, 2017

The project seems unfortunately quite abandoned at the moment. 😢 No new commits since December, and 5 open pull requests.

Do we have anyone with time and energy to fork it and maintain it? Or better yet, contact the original author (@sparklemotion) to be added as a maintainer here?

@Nakilon
Copy link

Nakilon commented Oct 24, 2018

The project seems unfortunately quite abandoned

I'm dealing with mechanize and its source code just told me I should use this library ..\

@grosser
Copy link

grosser commented Aug 15, 2019

eager load helps, ran this for 1 month and no more issues:

# eager load http-cookie gem to avoid random error
# https://github.com/sparklemotion/http-cookie/issues/6
cookie = $LOAD_PATH.detect { |l| l.match?(/\/http-cookie-\d/) }
Dir["#{cookie}/**/*.rb"].grep_v(/mozilla_store/).sort.each { |f| require f.sub("#{cookie}/", "").sub(".rb", "") }

Screen Shot 2019-09-19 at 1 47 37 PM

@headius
Copy link

headius commented Oct 18, 2019

I'm not sure it's related, but I found a similar bug in the AbstractStore class caching logic that can expose incomplete classes when called across threads: #27

@godfat
Copy link

godfat commented Oct 18, 2019

I concur that eagerly loading it will fix the problem. I had workaround almost 4 years ago and it never happened again:

@godfat
Copy link

godfat commented Oct 18, 2019

@jordan-thoms You might be interested about working around this problem in http-client. I found just HTTPClient.new and throw it away while loading the application works the best: godfat/rest-core@4ed0636

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 a pull request may close this issue.

8 participants