bugsnag / bugsnag-ruby

BugSnag error monitoring & reporting software for rails, sinatra, rack and ruby
https://docs.bugsnag.com/platforms/ruby
MIT License
249 stars 174 forks source link

warning: loading in progress, circular require considered harmful #822

Closed ArtemDordovskyi closed 5 months ago

ArtemDordovskyi commented 6 months ago

Describe the bug

I see warnings about circular require every time I run rake tasks.

Steps to reproduce

  1. Create rails application
    rails new test-bugsnag
    cd test-bugsnag
  2. Update rubygems
    gem update --system
  3. Add bugsnag to gems
    bundle add bugsnag
  4. Add $VERBOSE = true to ./config/application.rb config file at the top
    
    # ./config/application.rb
    require_relative "boot"

$VERBOSE = true

require "rails/all"

Require the gems listed in Gemfile, including any gems

you've limited to :test, :development, or :production.

Bundler.require(*Rails.groups)

4. Then run command and see warning

bundle exec rake -T


### Environment
* Bugsnag version: 6.26.4
* Ruby version: 3.2.1
* Bundle version: 2.4.5
* Integration framework version:
    * Rack: 3.0.11
    * Rails: 7.1.3.2
    * Rake: 13.2.1

<!--
  Below are a few approaches you might take to communicate the issue, in
  descending order of awesomeness. Please choose one and feel free to delete
  the others from this template.
-->

### Example Repo

- [x] Create a minimal repository that can reproduce the issue
- [x] Link to it here: https://github.com/ArtemDordovskyi/test-bugsnag

<details><summary>Error messages:</summary>

/home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30: warning: /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30: warning: loading in progress, circular require considered harmful - /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bugsnag-6.26.4/lib/bugsnag.rb from /home/user/.rbenv/versions/3.2.1/bin/bundle:25:in <main>' from /home/user/.rbenv/versions/3.2.1/bin/bundle:25:inload' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/exe/bundle:33:in <top (required)>' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/friendly_errors.rb:117:inwith_friendly_errors' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/exe/bundle:45:in block in <top (required)>' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/cli.rb:28:instart' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/cli.rb:34:indispatch' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:ininvoke_command' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/cli.rb:491:inexec' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/cli/exec.rb:23:in run' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/cli/exec.rb:58:inkernel_load' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/cli/exec.rb:58:in load' from /home/user/.rbenv/versions/3.2.1/bin/rake:25:in<top (required)>' from /home/user/.rbenv/versions/3.2.1/bin/rake:25:in load' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/exe/rake:27:in<top (required)>' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:80:in run' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:214:instandard_exception_handling' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:82:in block in run' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:125:inload_rakefile' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:214:in standard_exception_handling' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:126:inblock in load_rakefile' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:740:in raw_load_rakefile' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/rake_module.rb:29:inload_rakefile' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/rake_module.rb:29:in load' from /home/user/projects/test-bugsnag/Rakefile:4:in<top (required)>' from /home/user/projects/test-bugsnag/Rakefile:4:in require_relative' from /home/user/projects/test-bugsnag/config/application.rb:9:in<top (required)>' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler.rb:195:in require' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/runtime.rb:44:inrequire' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/runtime.rb:44:in each' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/runtime.rb:55:inblock in require' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/runtime.rb:55:in each' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/runtime.rb:60:inblock (2 levels) in require' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:in require' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:inrequire' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bugsnag-6.26.4/lib/bugsnag.rb:579:in <main>' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bugsnag-6.26.4/lib/bugsnag.rb:251:inload_integrations' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:in require' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:inrequire' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in require' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bugsnag-6.26.4/lib/bugsnag/integrations/railtie.rb:5:in

' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:in require' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:inrequire' from /home/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'


</details>
RobertoSmartBear commented 6 months ago

Hi @ArtemDordovskyi, we are looking into this and I will update the thread as we have more information. Thanks!

mclack commented 5 months ago

Hi @ArtemDordovskyi

This should now be fixed as of v6.27.1 of bugsnag-ruby: https://github.com/bugsnag/bugsnag-ruby/releases/tag/v6.27.1

Thanks again for raising this. Please let us know if you continue to see this warning after upgrading your SDK.