jpignata/temping

Regression in 3.6.1 - "Unable to autoload constant"

ajb opened this issue · 12 comments

ajb commented

After upgrading to 3.6.1, I started getting a ton of "Unable to autoload constant" errors on CircleCI. (Ruby 2.3.1, Ubuntu 12.04.)

I'm sorry I'm unable to provide much more information, or a reproducible test case.

It seems like the issue might be with the call to ActiveSupport::Dependencies.clear here: v3.5.0...v3.6.1#diff-f8e740db0f36b2ba48c1fe41c8dc2e20R24

kitop commented

Hi @ajb a reproducible test case would be very very helpful.

Is it only happening in CircleCI and not locally?

Also getting these showing up after upgrading from the 3.5 version.

ajb commented

Is it only happening in CircleCI and not locally?

Yes.

I apologize for not being able to include a test case, but I'm glad that someone else saw this issue and appears to be having the same problem.

kitop commented

@key88sf any reproducible test case you can provide?

@kitop Unfortunately not at this moment - we just reverted to 3.5.x for a quick solve.

@kitop this is happening to me as well.

kitop commented

@alessandro1997 any reproducible test case?

I'd really like to get it fixed, but need a case to work with.

@kitop the problem seems to be in the Temping.teardown method. If I don't run it, I don't get the issues.

kitop commented

Yes, as @ajb said, the issue is in the ActiveRecord::Dependencies.clear call in there—recently added to fix another issue with reusing classes.

Maybe it would make sense to move it to a different method, or pass it as an option to teardown.
Or we could only clear the caching for the constants created by temping, also in a different method. I'll investigate if that's possible.

What are your thoughts?

I'm also having this problem. Going to lock to an earlier version for now.

  • It seems like clearing the entire dependency cache is reaching pretty far outside of Temping's job description.
  • Making a new option Temping.teardown(and_clear_active_support_dependencies: true) still seems like strange behavior for Temping to own - if you want to clear all ActiveSupport dependencies after teardown, probably you should be doing it yourself?
  • Clearing only those constants owned by Temping seems reasonable, if it actually solves the problem. This might be the best path forward. After looking at the original PR #40, it looks like if we knew how to blast the cached reflections then that would still solve the problem.
kitop commented

Yes, I think the option in the teardown method is probably the best way to go, at least now.

ActiveSupport doesn't let you clear only some dependencies AFAIK, and doing so manually can break with future Rails versions.

kitop commented

Just pushed and released version 3.7.0, with clear_dependencies option added.

Closing this, feel free to comment if still failing.