Defect #32223

Disable sprockets to avoid Sprockets::Railtie::ManifestNeededError raised by sprockets 4.0.0

Added by Go MAEDA about 1 month ago. Updated 26 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Gems support
Target version:4.1.0
Resolution:Fixed Affected version:

Description

Redmine doesn't start with Sprockets::Railtie::ManifestNeededError if sprockets 4.0.0 is installed.

$ bin/rails c
Traceback (most recent call last):
    28: from bin/rails:4:in `<main>'
    27: from bin/rails:4:in `require'
.
.
.
/Users/maeda/redmines/gems/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/railtie.rb:105:in `block in <class:Railtie>': Expected to find a manifest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)
But did not, please create this file and use it to link any assets that need
to be rendered by your app:

Example:
  //= link_tree ../images
  //= link_directory ../javascripts .js
  //= link_directory ../stylesheets .css
and restart your server

disable-sprockets.patch Magnifier (1.47 KB) Go MAEDA, 2019-10-10 04:35

disable-sprockets.diff Magnifier (1.52 KB) Go MAEDA, 2019-10-19 05:04

require_bench.rb Magnifier (1.42 KB) Pavel Rosický, 2019-10-20 14:23


Related issues

Related to Redmine - Defect #32300: Don't use sprockets 4.0.0 in order to avoid Sprockets::Ra... Closed

Associated revisions

Revision 18859
Added by Go MAEDA 26 days ago

Disable sprockets to avoid Sprockets::Railtie::ManifestNeededError raised by sprockets 4.0.0 (#32223).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA about 1 month ago

The version of sprockets should be fixed at 3.7 until this issue is fixed.

diff --git a/Gemfile b/Gemfile
index 8eacdd122..762c6cefb 100644
--- a/Gemfile
+++ b/Gemfile
@@ -15,6 +15,9 @@ gem "nokogiri", "~> 1.10.0" 
 gem "i18n", "~> 1.6.0" 
 gem "rbpdf", "~> 1.20.0" 

+# TODO: Remove the following line when #32223 is fixed
+gem "sprockets", "~> 3.7.2" 
+
 # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
 gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin]

#2 Updated by Go MAEDA about 1 month ago

  • Subject changed from Redmine doesn't start with Sprockets :: Railtie :: ManifestNeededError if sprockets 4.0.0 is installed to Redmine doesn't start with Sprockets::Railtie::ManifestNeededError if sprockets 4.0.0 is installed

Fixed the version of sprockets at 3.7 in r18629.

#3 Updated by Alexander Meindl about 1 month ago

Sprockets 4 requires ruby 2.5 or newer, too. This means, at the moment if you try to install Redmine 4 with ruby e.g. 2.3, bundler is failling. Your patch is required in Redmine 4.0.x, to support older ruby versions again.

#4 Updated by Go MAEDA about 1 month ago

Alexander Meindl wrote:

Sprockets 4 requires ruby 2.5 or newer, too. This means, at the moment if you try to install Redmine 4 with ruby e.g. 2.3, bundler is failling. Your patch is required in Redmine 4.0.x, to support older ruby versions again.

I have committed the same change in 4.0-stable branch in r18634. Thank you for the explanation.

#5 Updated by Go MAEDA about 1 month ago

The attached patch fixes this issue. I would like Rails exports to review it.

#6 Updated by Giorgos Tsirkas about 1 month ago

I have the same issue having redmine4.0.4 source, Ruby2.5 and Rails 5.2.3

#7 Updated by Go MAEDA about 1 month ago

  • Subject changed from Redmine doesn't start with Sprockets::Railtie::ManifestNeededError if sprockets 4.0.0 is installed to Disable sprockets to avoid Sprockets::Railtie::ManifestNeededError raised by sprockets 4.0.0
  • Description updated (diff)
  • Target version set to 4.1.0

I would like to commit disable-sprockets.patch (#32223#note-5) after it has reviewed by people here.

Setting the target version to 4.1.0.

#8 Updated by Jose Antonio Garcia about 1 month ago

Same problems appears in 3.3-stable branch.

#9 Updated by Go MAEDA about 1 month ago

Jose Antonio Garcia wrote:

Same problems appears in 3.3-stable branch.

Redmine 3.3 is no longer maintained. So, an update for this issue will not be released.

However, you can fix the error by your self. Please create a file "Gemfile.local" and add the following line.

gem "sprockets", "~> 3.7.2" 

#10 Updated by Mischa The Evil about 1 month ago

Two things regarding the patch from #note-5:
  1. I don't know if disabling/removing sprockets this way in the Redmine core makes enabling of the Rails asset pipeline locally more difficult than it currently is?
  2. Are you sure everything needed by the core is indeed loaded with this config?
FTR: some back-references to this issue in the forums:

FWIW: given r18635, this issue's target version should probably be set to 3.4.12.

#11 Updated by Go MAEDA about 1 month ago

Mischa The Evil wrote:

  1. I don't know if disabling/removing sprockets this way in the Redmine core makes enabling of the Rails asset pipeline locally more difficult than it currently is?

Sorry, I don't know.

  1. Are you sure everything needed by the core is indeed loaded with this config?

I think active_storage and action_cable can be removed at least, but I think this issue should stick to removing sprockets because it is off-topic for this issue. We can discuss removing other libraries in another issue after the change is committed.

FWIW: given r18635, this issue's target version should probably be set to 3.4.12.

I am afraid that disabling sprockets will break some plugins.

#12 Updated by Go MAEDA about 1 month ago

Updated the patch. Just replaced double quotation marks with single quotation marks.

#13 Updated by Jean-Philippe Lang about 1 month ago

  • Related to Defect #32300: Don't use sprockets 4.0.0 in order to avoid Sprockets::Railtie::ManifestNeededError added

#14 Updated by Mischa The Evil 30 days ago

Go MAEDA wrote:

Mischa The Evil wrote:

  1. Are you sure everything needed by the core is indeed loaded with this config?

I think active_storage and action_cable can be removed at least, but I think this issue should stick to removing sprockets because it is off-topic for this issue. We can discuss removing other libraries in another issue after the change is committed.

What I meant was not about what else we can remove; just about what Redmine needs to function correctly.

FWIW: given r18635, this issue's target version should probably be set to 3.4.12.

I am afraid that disabling sprockets will break some plugins.

JPL fixed what I was referring to by opening #32300. IMHO this should be fixed at the root in either sprockets itself or Redmine somehow.

#15 Updated by Pavel Rosický 30 days ago

Go MAEDA your patch improves startup time and memory consumtion.

disable-sprockets.diff
before
  2.078125   4.734375   6.812500 (  8.833407)
mem: 47841280.0

after
  1.234375   2.687500   3.921875 (  3.926718)
mem: 34430976.0

but that belongs to the next version, not for maintainance releases in order to fix the sprockets problem.

#16 Updated by Mischa The Evil 30 days ago

Pavel Rosický wrote:

[...]

How do you generate these numbers? On what system? Can you remove active_storage and action_cable too and benchmark those configs too? I'm curious what difference it makes in your case.

#17 Updated by Go MAEDA 30 days ago

Mischa The Evil wrote:

Go MAEDA wrote:

Mischa The Evil wrote:

  1. Are you sure everything needed by the core is indeed loaded with this config?

I think active_storage and action_cable can be removed at least, but I think this issue should stick to removing sprockets because it is off-topic for this issue. We can discuss removing other libraries in another issue after the change is committed.

What I meant was not about what else we can remove; just about what Redmine needs to function correctly.

Sorry for the misreading.

I believe the config loads all libraries needed to run a Rails app. Actually, the set of "require" methods was not written by me but generated by `rails new appname --skip-sprockets`.

#18 Updated by Pavel Rosický 30 days ago

Mischa The Evil wrote:

Pavel Rosický wrote:

[...]

How do you generate these numbers? On what system? Can you remove active_storage and action_cable too and benchmark those configs too? I'm curious what difference it makes in your case.

benchmark included

#19 Updated by Go MAEDA 28 days ago

Mischa The Evil wrote:

IMHO this should be fixed at the root in either sprockets itself or Redmine somehow.

Probably sprockets will never be fixed. A maintainer of sprockets wrote that "you need to change the require 'rails/all' to require the individual railties and leave the sprockets railties out of the list".
https://github.com/rails/sprockets/issues/643#issuecomment-544589461

Considering the comment, disable-sprockets.diff is the right approach to fix this issue.

#20 Updated by Go MAEDA 26 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix to the trunk.

Also available in: Atom PDF