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

Not everything gets loaded in rails c #1728

Closed
eugenk opened this issue Jul 8, 2016 · 6 comments · Fixed by #1780
Closed

Not everything gets loaded in rails c #1728

eugenk opened this issue Jul 8, 2016 · 6 comments · Fixed by #1780

Comments

@eugenk
Copy link
Member

eugenk commented Jul 8, 2016

Logged into the rails c production on ontohub.org, when I execute

ActiveRecord::Base.logger.level = 1; threads = Repository.find_by_path('eugens-test-1').ontologies.where(parent_id: nil).map(&:current_version).map { |ov| Thread.new { ov.parse_full } }.each(&:join)

I get errors that indicate incomplete application loading. It randomly doesn't find classes in the top namespace, like Semaphore, AccessTokenDeletionWorker or TimeoutWorker (raising NameErrors with NameError: uninitialized constant ...). As far as I remember, they all reside in the lib directory. I'm not 100% sure of it, though.

@eugenk
Copy link
Member Author

eugenk commented Aug 12, 2016

This also seems to be a problem in Sidekiq.

@eugenk eugenk added this to the improve stability milestone Aug 12, 2016
@eugenk
Copy link
Member Author

eugenk commented Aug 12, 2016

Maybe don't _auto_load the lib directory (lazily), but rather eager load it.

@phyrog
Copy link
Contributor

phyrog commented Aug 12, 2016

The problem with eager loading lib is that there are some files that are only for command line git and should not be loaded normally. Unfortunately we can only specify directories to be eager loaded, but not files (where we could exclude those). For that to work, we need to split the lib directory into files that should be loaded and those that should not be loaded normally (environment_light.rb is one of those).

@eugenk
Copy link
Member Author

eugenk commented Aug 12, 2016

So, now, this is related to #1597.

@tillmo
Copy link
Member

tillmo commented Aug 12, 2016

This split should be not too difficult?

@phyrog
Copy link
Contributor

phyrog commented Aug 12, 2016

I think this is the same problem we're having. The multiple threads are loading the same files at the same time, which is not thread-safe up until Rails 4.2.

We could try to monkey patch the changes in the commit (which is basically just a lock around the loading) into our rails. Rails 3 does not have this method, but instead a config variable. This is by default false, so this does not fix the errors.

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.

3 participants