Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent SEGFAULT when precompiling assets as part of the build process #767

Closed
lexiwitch opened this issue Oct 26, 2021 · 2 comments
Closed
Assignees
Milestone

Comments

@lexiwitch
Copy link
Contributor

lexiwitch commented Oct 26, 2021

Problem

There is currently an intermittent Segmentation Fault when running the build/test step

bundle exec rake

The output is roughly:

       /tmp/build/vendor/bundle/ruby/2.6.0/gems/sassc-2.2.1/lib/sassc/engine.rb:42: [BUG] Segmentation fault at 0x0000000000000000
       ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
       
-- Control frame information -----------------------------------------------
       c:0048 p:---- s:0351 e:000350 CFUNC  :compile_data_context
       c:0047 p:0298 s:0346 e:000345 METHOD /tmp/build/vendor/bundle/ruby/2.6.0/gems/sassc-2.2.1/lib/sassc/engine.rb:42
       c:0046 p:0006 s:0334 e:000333 BLOCK  /tmp/build/vendor/bundle/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc/rails/template.rb:40
       c:0045 p:0028 s:0331 e:000330 METHOD /tmp/build/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.0/lib/sprockets/utils.rb:138
    [...]

Cause

This is due to a concurrency race condition bug in the combination sprockets-4.0.0 and sassc-2.2.1, see the following issues for more information: sass/sassc-ruby#167, rails/sprockets#581, rails/sprockets#633, rails/sprockets#630

Possible Remediations:

  1. Bump sprockets down to a 3. version (changing it to >3 and <4)
  2. Bump sassc down to 2.0.0 or up to 2.4.0 (The bug persists through 2.4.0, it's not known if it persists further)
  3. Adding the following to config/initializers/assets.rb or a more relevant assets.rb file:
# Bypass segfault in sassc 2.* + sprockets 4: https://github.com/rails/sprockets/issues/581#issuecomment-486984663
Rails.application.config.assets.configure do |env|
  env.export_concurrent = false
end

Selected Remediation:

Given that we do not explicitly depend on sprockets or sassc in our Gemfile, I decided to go with remediation 3, and move up the list if that does not solve it.

Problems

Because this issue is intermittent, it is not guaranteed that any given remediation will actually have solved the problem until we fail to see it happen long-term

@lexiwitch lexiwitch self-assigned this Oct 26, 2021
@lexiwitch lexiwitch added this to the Server love milestone Oct 26, 2021
@lexiwitch lexiwitch reopened this Oct 26, 2021
@lexiwitch
Copy link
Contributor Author

Given that 9b5d956 seems to fix it (https://app.travis-ci.com/github/geeksforsocialchange/PlaceCal/jobs/545219716), I'm pulling production up to master to enable travis to push to dokku for us

@lexiwitch
Copy link
Contributor Author

Seems to be fixed, will reopen if issue presents in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant