sprockets-rails: Infinite recursion in SourcemappingUrlProcessor
We have an asset in our project that appears to be causing an infinite recursion in the new SourcemappingUrlProcessor
with a stack that looks like:
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-rails-3.4.0/lib/sprockets/rails/sourcemapping_url_processor.rb:15:in `block in call'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-rails-3.4.0/lib/sprockets/rails/sourcemapping_url_processor.rb:12:in `gsub'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-rails-3.4.0/lib/sprockets/rails/sourcemapping_url_processor.rb:12:in `call'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:22:in `block in <class:CompositeProcessor>'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:33:in `call'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/context.rb:116:in `load'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/context.rb:144:in `depend_on_asset'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/context.rb:184:in `link_asset'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-rails-3.4.0/lib/sprockets/rails/context.rb:27:in `compute_asset_path'
/usr/local/share/gems/ruby/3.0.0/gems/actionview-6.1.4.1/lib/action_view/helpers/asset_url_helper.rb:203:in `asset_path'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-rails-3.4.0/lib/sprockets/rails/sourcemapping_url_processor.rb:18:in `block in call'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-rails-3.4.0/lib/sprockets/rails/sourcemapping_url_processor.rb:12:in `gsub'
/usr/local/share/gems/ruby/3.0.0/gems/sprockets-rails-3.4.0/lib/sprockets/rails/sourcemapping_url_processor.rb:12:in `call'
which then repeats over and over.
The asset that triggers it is https://github.com/Johann-S/bs-custom-file-input/blob/master/dist/bs-custom-file-input.js and although the url map comment seems sensible the preprocessor gets reinvoked for bs-custom-file-input.js
rather than bs-custom-file-input.js.map
when build the asset path.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 10
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Update gems Pin sprockets-rails due to https://github.com/rails/sprockets-rails/issues/481 — committed to Arie/serveme by Arie 3 years ago
- Only process sourceMappingURLs for files, not paths This will prevent the recursion issue noticed in #481. — committed to rails/sprockets-rails by dhh 3 years ago
- Lift sprockets-rails gem version restriction, bug mentioned in https://github.com/rails/sprockets-rails/issues/481 was fixed a while ago — committed to Arie/serveme by Arie 2 years ago
- Update gems Pin sprockets-rails due to https://github.com/rails/sprockets-rails/issues/481 — committed to Arie/serveme by Arie 3 years ago
- Lift sprockets-rails gem version restriction, bug mentioned in https://github.com/rails/sprockets-rails/issues/481 was fixed a while ago — committed to Arie/serveme by Arie 2 years ago
+1 Got the same problem yesterday and had to rollback to the previous version. I haven’t had time to identify the asset that triggered the bug, but I’m getting the same type of recursion.
Same issue after updating to 3.4.0, reverting to 3.2.2 solved the problem.