Skip to content

Commit

Permalink
Try this one trick to remove seg faults
Browse files Browse the repository at this point in the history
Using Sassc and Sprockets seems somewhat prone to segmentation faults
which seems to be a common issue with Sprockets 4. As per
rails/sprockets#633 and
sass/sassc-ruby#207, switching concurrent
asset generation seems to resolve the problem. The unproven theory is
that this reflects that Sprockets 4 uses threads which causes problems
for sassc.

A consequence of this is that asset pre-compilation may be slower than
it could be.
  • Loading branch information
kevindew committed Mar 21, 2022
1 parent 6cae440 commit 9dde7b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@
#{__dir__}/../../node_modules/govuk-frontend/
#{__dir__}/../../node_modules/
]

# We've experienced segmentation faults when pre-compiling assets with libsass.
# Disabling Sprockets 4's export_concurrent setting seems to resolve the issues
# see: https://github.com/rails/sprockets/issues/633
Rails.application.config.assets.configure do |env|
env.export_concurrent = false if env.respond_to?(:export_concurrent=)
end

0 comments on commit 9dde7b5

Please sign in to comment.