-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Apps should not require SIDEKIQ_PRELOAD= with sidekiqswarm #4766
Comments
Yes, we have to use So I did some digging. It comes down to some gems need Rails fully-loaded before they can be If I mimic what Rails generates for config/application.rb in bin/sidekiqswarm, it works:
I figure you can't actually change sidekiq-ent to have a rails dependency like that. So I made the switch to However, I'm unsure if there's downsides to that. |
That’s exactly the symptom I saw this morning, a gem failed to load because it was looking for Rails::VERSION. |
The only issue with requiring require 'rails'
%w(
active_record/railtie
action_controller/railtie
action_view/railtie
action_mailer/railtie
active_job/railtie
sprockets/railtie
).each do |railtie|
begin
require railtie
rescue LoadError
end
end
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups) This example leaves out ActionText, ActionCable, etc. I think Rails is really missing a more explicit API for disabling subsystems. |
For the record:
|
Please add a comment if you find any other gems (and links to gem issues you open!) which break preload. |
I ran into a similar issue with |
I'm running into this with |
Hi @mperham! I've experienced the same as #4766 (comment).
How worthwhile is it to do more than the workaround? At the very least, this should go into the Wiki for troubleshooting as I lost some hours before I found this issue.
|
The wiki is publicly editable. That looks like an issue in cloudflare-rails. They don’t actually require “rails” so they are assuming that Rails is loaded first. https://github.com/modosc/cloudflare-rails/blob/main/lib/cloudflare/rails/railtie.rb |
By moving Rails earlier in the Gemfile, the problem went to another gem. The suggestion to add: |
Looks like shoryuken can be added to the list of gems that break preload:
As said above, setting both |
Yeah, they are trying to extend Rails functionality at require time rather than in a Railtie initializer. Bad idea. |
I suppose rather than
|
Open an issue with them. Ask them to modernize their Rails integration.
…On Thu, Dec 9, 2021 at 16:31 Nick Giancola ***@***.***> wrote:
I suppose rather than require: "rails/all" you can just use Gemfile as
your declaration of frameworks instead of application.rb, e.g:
gem "rails", "6.1.4.1", require: ["active_record/railtie", "action_controller/railtie", "action_mailer/railtie"]
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4766 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAWX5P7K4IT7ELEKL3AT3UQFC5VANCNFSM4VBVR6YQ>
.
|
@mperham I just tried switching my worker from Note: I have Any suggestions? Is this another example of what you're looking for?
|
If you look at the top of the backtrace, the error starts in the |
|
@mperham While I'm working to resolve the issues with the scenic gem, is there any way to change the way to fully load rails and then launch sidekiqswarm afterwards? This question probably doesn't make a lot of sense. To restate it: rails is loading fine. I get that I have a gem which is breaking the rails loading process and somehow the way sidekiqswarm initializes, it's hitting this issue. Can I cause sidekiqwarm to initialize in a way that more closely mirrors how rails itself loads so that I can sidestep this issue, for now? |
@krschacht Because scenic is broken, you need to preload Rails before any other gems. It's been mentioned above: gem "rails", require: "rails/all" |
running into this issue with latest version of Rails 7 support with the paper_trail gem https://github.com/paper-trail-gem/paper_trail |
Did you open an issue with them?
…On Tue, Jan 25, 2022 at 21:03 Maxwell Salzberg ***@***.***> wrote:
running into this issue with latest version of Rails 7 support with the
paper_trail gem https://github.com/paper-trail-gem/paper_trail
—
Reply to this email directly, view it on GitHub
<#4766 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAWX7ACOPQLVJ4ULA3UKDUX56A5ANCNFSM4VBVR6YQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
is there a way to give the maintainer a repo that includes sidekiq-ent so I can make a repo that reproduces the issue for them?
|
Not really but make sure you are using the latest version and include a
backtrace.
On Tue, Jan 25, 2022 at 21:39 Maxwell Salzberg ***@***.***>
wrote:
… is there a way to give the maintainer a repo that includes sidekiq-ent so
I can make a repo that reproduces the issue for them?
Did you open an issue with them?
… <#m_-8937956344943976106_>
On Tue, Jan 25, 2022 at 21:03 Maxwell Salzberg *@*.*> wrote: running into
this issue with latest version of Rails 7 support with the paper_trail gem
https://github.com/paper-trail-gem/paper_trail
<https://github.com/paper-trail-gem/paper_trail> — Reply to this email
directly, view it on GitHub <#4766 (comment)
<#4766 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAAWX7ACOPQLVJ4ULA3UKDUX56A5ANCNFSM4VBVR6YQ
<https://github.com/notifications/unsubscribe-auth/AAAAWX7ACOPQLVJ4ULA3UKDUX56A5ANCNFSM4VBVR6YQ>
. You are receiving this because you were mentioned.Message ID: @.*>
—
Reply to this email directly, view it on GitHub
<#4766 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAWX3ORNVC64NJTXBM7OLUX6CJ7ANCNFSM4VBVR6YQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I ran into this when trying to use active_storage_validations. It was another case of the gem having dependencies on rails components, but not requiring them, so I filed an issue: igorkasyanchuk/active_storage_validations#197 I confirmed
|
I found a workaround in case it's useful for others. I updated our gem 'active_storage_validations', require: ['active_model', 'active_storage_validations'] It still should be fixed upstream, but at least this helps unblock without having to wait for / make for a fix, and have it released. |
I've had two different Sidekiq Enterprise customers today who had to disable Bundler preload because their app would not boot successfully with
sidekiqswarm
. I'd like to investigate why so I can determine if there's a few widespread reasons that can be fixed or if this is something really app-specific.Disabling Bundler preload causes your app to use more memory.
If any Enterprise customers have an app that does boot with
SIDEKIQ_PRELOAD= bundle exec sidekiqswarm
but does not boot successfully withbundle exec sidekiqswarm
, please explain below if you know why. If you don't know why, put any error message and backtrace below. I would be interested in consulting with you to determine the reason and possibly fix it.https://github.com/mperham/sidekiq/wiki/Ent-Multi-Process#bundler-preload
The text was updated successfully, but these errors were encountered: