Skip to content

undefined method `exception' for nil:NilClass with Ruby 3.1.0 #931

Closed
@aaronjensen

Description

@aaronjensen
* Operating system:                 mac 
* Ruby implementation:             Ruby 3.1.0
* `concurrent-ruby` version:       1.1.9
* `concurrent-ruby-ext` installed:  no
* `concurrent-ruby-edge` used:     no

After upgrading to Ruby 3.1.0 I'm getting a very strange, very hard (for me) to debug error with premailer+sprockets that ultimately manifests with concurrent failing to provide a reason for a promise rejection.

The error is strange enough that it seems like it could be a ruby bug.

When stepping through with byebug I get here:

https://github.com/rails/sprockets/blob/v4.0.2/lib/sprockets/manifest.rb#L143

Then, drilling into asset.source, it returns the source fine. The yield however causes a jump all the way out of the begin in SafeTaskExecutor#execute. If I put an ensure on that begin, it runs. Nothing after @task.call in the block runs. No exception can be caught.

I then get this:

        project/gems/ruby/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/obligation.rb:128:in `exception': undefined method `exception' for nil:NilClass

        reason.exception(*args)
              ^^^^^^^^^^ (NoMethodError)
                from project/gems/ruby/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/obligation.rb:87:in `raise'
                from project/gems/ruby/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/obligation.rb:87:in `block in wait!'
                from <internal:kernel>:90:in `tap'
                from project/gems/ruby/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/obligation.rb:87:in `wait!'
                from project/gems/ruby/3.1.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:141:in `each'
                from project/gems/ruby/3.1.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:141:in `find'
                from project/gems/ruby/3.1.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:153:in `each'
                from project/gems/ruby/3.1.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:153:in `find_sources'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_loaders/asset_pipeline_loader.rb:13:in `each'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_loaders/asset_pipeline_loader.rb:13:in `first'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_loaders/asset_pipeline_loader.rb:13:in `load'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_helper.rb:48:in `block in load_css'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_helper.rb:46:in `each'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_helper.rb:46:in `load_css'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_helper.rb:20:in `css_for_url'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_helper.rb:13:in `block in css_for_doc'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_helper.rb:13:in `map'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/css_helper.rb:13:in `css_for_doc'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/customized_premailer.rb:14:in `initialize'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/hook.rb:93:in `new'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/hook.rb:93:in `premailer'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/hook.rb:74:in `generate_html_part'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/hook.rb:52:in `generate_html_part_replacement'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/hook.rb:24:in `perform'
                from project/gems/ruby/3.1.0/gems/premailer-rails-1.11.1/lib/premailer/rails/hook.rb:8:in `perform'
 

I may be able to narrow down a repro if that would be useful, but I wanted to file this now in case there are already any known issues or work arounds I'm not aware of.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions