sass / sassc-ruby

Use libsass with Ruby!
MIT License
367 stars 156 forks source link

Segmentation fault when precompiling assets #207

Open gabo-cs-zz opened 4 years ago

gabo-cs-zz commented 4 years ago

Sometimes, when I make some changes to my .scss files in my Rails 6 app, I get the following when running rails assets:precompile

Screen Shot 2020-05-14 at 9 45 36 PM

And also, when deploying to Heroku, I get rubyDone in 4.85s. remote: /tmp/build_929254ebef3a89a9f40b4b26f007bde3/vendor/bundle/ruby/2.7.0/gems/sassc-2.3.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000 remote: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux] -- Control frame information ----------------------------------------------- remote: c:0059 p:---- s:0449 e:000448 CFUNC :compile_data_context remote: c:0058 p:0314 s:0444 e:000443 METHOD /tmp/build_c5dc2802730effed8a887745a1195bb5/vendor/bundle/ruby/2.7.0/gems/sassc-2.3.0/lib/sassc/engine.rb:43 along with Aborted. remote: ! Precompiling assets failed. and it won't do the deployment successfully. I keep getting

remote:        
remote:        Aborted
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected 

I don't get any other errors, so I think it's merely related to that compilation thing. I tried upgrading & downgrading the version of the gem but still can't get it through. I've been having this problem a while ago now and it had been sort of random, it wouldn't show up always, but recently, I get it almost every time I make a CSS change.

Can anybody help me out here? Thanks a lot in advance.

josh-m-sharpe commented 3 years ago

I believe I'm seeing the same thing while running tests on CircleCI. My test suite runs fine until it hits my integration tests which compile assets.

I've tried with these combos: ruby 2.6.6 & sassc 2.4.0 ruby 2.6.6 & sassc 2.3.0

Test output:

# Running:

.........................../home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sassc-2.3.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0048 p:---- s:0351 e:000350 CFUNC  :compile_data_context
c:0047 p:0318 s:0346 e:000345 METHOD /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sassc-2.3.0/lib/sassc/engine.rb:43
c:0046 p:0006 s:0334 e:000333 BLOCK  /home/circleci/project/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 /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/utils.rb:138
c:0044 p:0164 s:0324 e:000323 METHOD /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc/rails/template.rb:39
c:0043 p:0053 s:0315 e:000314 METHOD /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84
c:0042 p:0016 s:0307 e:000306 BLOCK  /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66 [FINISH]
c:0041 p:---- s:0302 e:000301 CFUNC  :reverse_each
c:0040 p:0039 s:0298 e:000297 METHOD /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65
c:0039 p:0015 s:0290 e:000289 BLOCK  /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:22
c:0038 p:0013 s:0285 e:000284 METHOD /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:33
c:0037 p:0053 s:0280 e:000279 METHOD /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84
c:0036 p:0016 s:0272 e:000271 BLOCK  /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66 [FINISH]
c:0035 p:---- s:0267 e:000266 CFUNC  :reverse_each
inopinatus commented 3 years ago

I saw something very similar after upgrading an older app to Sprockets 4, which introduced concurrent asset compilation. I'm guessing that something within sassc-ruby or libsass isn't thread-safe.

The problem goes away (for me) with Sprockets.export_concurrent = false in an initializer.

gabo-cs-zz commented 3 years ago

I saw something very similar after upgrading an older app to Sprockets 4, which introduced concurrent asset compilation. I'm guessing that something within sassc-ruby or libsass isn't thread-safe.

The problem goes away (for me) with Sprockets.export_concurrent = false in an initializer.

Yes, that's same as doing

config.assets.configure do |env|
    env.export_concurrent = false
end

in the application.rb, but not always works.

murtra commented 3 years ago

I'm having the same crash in development mode for an app that was recently upgraded to Sprockets 4 (Ruby 2.6.6, Rails 6.0.3). It's a random thing but happens very often.

Disabling concurrent asset compilation fixed the issue for me.

rlgreen91 commented 3 years ago

I'm seeing the same issues in our app, which uses Ruby 2.6.6 and Rails 5.0.7. The gem is at the most recent version, 2.4.0. This also occurred after an update to Sprockets 4.

The recommended solution of disabling concurrent asset compilation does not work when running our test suite locally.

bhserna commented 3 years ago

I was having a similar problem to @rlgreen91, my tests were also failing... And I found that the problem was in my code...

I was @importing a file from a dependency that I was just removed. After I removed the @import the segmentation fault was gone... It was not the best error message jeje, but the error was in my code.

... So if you are reading this thread, because you have a similar error, maybe your problem could also be a bad @import.

epugh commented 3 years ago

@bhserna your commented fixed my problem! Thhank you!

mvz commented 3 years ago

I have created an example app that reproduces this problem: https://github.com/mvz/example-app-sprockets-crash

stevenwilliamson commented 3 years ago

We are seeing the same problem segfault in the compile_data_context function. It is intermittent and we do not hit it every build but we tend to see the issue in CI when tests are running and Rails is compiling assets on the fly.

It does not look like there has been a commit to this repo for over a year, is this gem still active gem, is it deprecated, is it in maintenance, EOL?

It's not clear from looking at the Git repo if this is an active project or not, should we be using something else etc ?

epugh commented 3 years ago

@stevenwilliamson I am sympathetic!

I've been trying to figure out how to reduce the number of dependencies that I use in Rails, and this is an example of why... I'm maintaining an app that is 8 years old now, and it's a reminder that while my app may not change, the architectures under it are constantly evolving...

MarkerDave commented 3 years ago

We get the same error using Ruby 2.5.8 or 2.7.2 with rails 5.0.7.2, Sassc 2.4.0 and Sprockets 4.0. Setting export_concurrent = false does not fix the problem for us.

Antiarchitect commented 2 years ago

Also having similar issue: Here is stacktrace: https://gist.github.com/Antiarchitect/c8ffeb01305f4ebed3b078eef6818cdc

aquadrehz commented 2 years ago

Also having similar issue: Here is stacktrace: https://gist.github.com/Antiarchitect/c8ffeb01305f4ebed3b078eef6818cdc

For any one still got this issue I've downgrade Sprocket gem to 3.7.2

gem 'sprockets', '3.7.2'

Then it's work. Please check more detail from https://github.com/rails/sprockets/issues/633

estebanz01 commented 2 years ago

Just adding another comment saying that disabling the concurrent mode fixes the issue for me. Basically, I did this:

Sprockets.export_concurrent = false if Rails.env.test?

So I can run the tests in my CI job.

uasi commented 2 years ago

I had the same issue on Intel Mac using Ruby 2.7.4, Rails 5.0.7.1, Sprockets 3.7.1, sassc 2.0.1, ffi 1.14.2, and libffi 3.4.2.

For me, only updating ffi gem to 1.15.4 fixed the issue. It seems the issue was triggered by a subtle incompatibility among libffi, ffi gem, and sassc native ext.

mfittko commented 2 years ago

For us the problem could be identified as iterating through a non thread-safe array in the manifest.json.erb file that is part of our asset pipeline, so maybe that helps some of you. We solved it by wrapping the array in Concurrent::Array.new. Might also work for a Concurrent::Hash.new, so check if you're having a loop within an erb file that is part of your pipeline.

jussihirvi commented 2 years ago

I use sass-rails, but stumbled on the same issue after upgrading ruby from 2.7.2 to 2.7.5, using rails 6.0.4.6 and sass-rails 6.0.0. Deleting everything from the assets folder (except config/manifest.js) did not help.

The problem vanished after I downgraded sass-rails to the newest 5.x version (5.1.0). I also had to downgrade sprockets from 4.0.3 to 3.7.2, because sass-rails 5.1.0 requires sprockets version <4.

kyrylo commented 2 years ago

@jussihirvi thank you! That helped me as well. I am tremendously grateful for your solution.

thisismydesign commented 1 year ago

I got this on sassc-2.4.0 and ruby-2.7.0

krzyczak commented 1 year ago

I just got the same issue with ruby 3.2 and rails 7.0.1 (Old macOS 13.10 - not sure if that's important).

I can confirm that adding Sprockets.export_concurrent = false solved the issue.

stanhu commented 8 months ago

I think we can close this issue because this is an issue with Sprockets, not with sassc-ruby.

I can reproduce the crash with Sprockets v3.7.2 and confirmed that it was indeed a thread-safety issue that has now been fixed in Sprockets v4.2.0 via https://github.com/rails/sprockets/pull/759. Those of you having trouble might want to upgrade to v4.2.1. I'm not sure if Sprockets.export_concurrent is still needed, but it might be.

In GitLab, we use Sidekiq to run background jobs to send notification e-mails. I can easily reproduce a seg fault by:

  1. Clear the Sprockets cache: rm -rf tmp/cache/assets/sprockets/v3.0.
  2. Run many instances of the job at the same time. In the Rails console, I scheduled the same job:
20.times { NewIssueWorker.perform_async(1, 1) }

I believe this was happening:

  1. When multiple Sidekiq jobs attempt to render SCSS in notification e-mails, Sprockets invokes SassC::Rails::SassTemplate.call on a singleton object via processor_utils.rb.

  2. Sprockets::Utils.module_include was previously not thread-safe, so the SASS functions list passed to libsass would be corrupted by one thread.

  3. When libasss attempted to look up a SASS function, it would hit a seg fault if the function it needed wasn't in the list.

The following contains the Ruby and C backtrace:

/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0251 p:---- s:1513 e:001512 CFUNC  :compile_data_context
c:0250 p:0314 s:1508 E:0013d0 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43
c:0249 p:0004 s:1496 E:0000e0 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-rails-2.1.0/lib/sassc/rails/template.rb:40
c:0248 p:0050 s:1493 E:001888 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:171
c:0247 p:0166 s:1486 E:000748 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-rails-2.1.0/lib/sassc/rails/template.rb:39
c:0246 p:0007 s:1477 E:001568 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:30
c:0245 p:0047 s:1472 E:001c40 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75
c:0244 p:0013 s:1464 E:000920 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57 [FINISH]
c:0243 p:---- s:1459 e:001458 CFUNC  :reverse_each
c:0242 p:0035 s:1455 E:000040 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56
c:0241 p:0337 s:1447 E:001290 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134
c:0240 p:0068 s:1427 E:000cb8 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60
c:0239 p:0033 s:1421 E:0001d0 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317
c:0238 p:0129 s:1411 E:0026b8 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44
c:0237 p:0010 s:1402 E:000ef0 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20 [FINISH]
c:0236 p:0007 s:1394 E:001658 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47
c:0235 p:0006 s:1387 E:0019c8 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23
c:0234 p:0079 s:1383 E:000e28 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200
c:0233 p:0091 s:1372 E:0000d8 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24
c:0232 p:0047 s:1357 E:001150 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75
c:0231 p:0013 s:1349 E:000fe0 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57 [FINISH]
c:0230 p:---- s:1344 e:001343 CFUNC  :reverse_each
c:0229 p:0035 s:1340 E:000080 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56
c:0228 p:0337 s:1332 E:001d30 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134
c:0227 p:0068 s:1312 E:002078 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60
c:0226 p:0033 s:1306 E:001250 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317
c:0225 p:0129 s:1296 E:000138 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44
c:0224 p:0010 s:1287 E:002230 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20 [FINISH]
c:0223 p:0007 s:1279 E:000348 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47
c:0222 p:0031 s:1272 E:002670 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66
c:0221 p:0007 s:1264 E:002298 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:92
c:0220 p:0013 s:1259 E:002290 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:358
c:0219 p:0009 s:1253 E:002368 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:337
c:0218 p:0015 s:1246 E:0022c0 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:326
c:0217 p:0011 s:1238 E:0021b8 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:103
c:0216 p:0005 s:1234 E:001570 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:243 [FINISH]
c:0215 p:---- s:1229 E:001150 IFUNC
c:0214 p:---- s:1226 e:001225 CFUNC  :each
c:0213 p:---- s:1223 E:001ba0 CFUNC  :detect
c:0212 p:0006 s:1219 E:001540 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:242
c:0211 p:0008 s:1215 E:001bb0 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:102
c:0210 p:0019 s:1209 E:001550 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:80
c:0209 p:0144 s:1199 E:0003b0 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/actionview-7.0.8/lib/action_view/helpers/asset_url_helper.rb:203
c:0208 p:0015 s:1189 E:001690 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/actionview-7.0.8/lib/action_view/helpers/asset_url_helper.rb:348
c:0207 p:0008 s:1183 E:000bd0 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/actionview-7.0.8/lib/action_view/helpers/asset_tag_helper.rb:180 [FINISH]
c:0206 p:---- s:1176 e:001175 CFUNC  :map
c:0205 p:0085 s:1172 E:0006b0 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/actionview-7.0.8/lib/action_view/helpers/asset_tag_helper.rb:179
c:0204 p:0030 s:1160 E:000ea8 BLOCK  /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:186 [FINISH]
c:0203 p:---- s:1156 e:001155 CFUNC  :map
c:0202 p:0053 s:1152 E:0016f8 METHOD /home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/helper.rb:184
c:0201 p:0104 s:1145 E:000200 METHOD /home/gdk/gitlab-development-kit/gitlab/app/views/layouts/notify.html.haml:7 [FINISH]
c:0200 p:---- s:1129 e:001128 CFUNC  :public_send

-- C level backtrace information -------------------------------------------
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(rb_print_backtrace+0x11) [0x7fc3e158f5bf] vm_dump.c:759
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(rb_vm_bugreport) vm_dump.c:1045
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(rb_bug_for_fatal_signal+0xf4) [0x7fc3e138a474] error.c:821
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(sigsegv+0x4d) [0x7fc3e14e3e6d] signal.c:964
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7fc3e1283420]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(sass_value_get_tag+0x10) [0x7fc3d1d840d2]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass4EvalclEPNS_13Function_CallE+0x1db5) [0x7fc3d1c721d7]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass13Function_Call7performEPNS_9OperationIPNS_10ExpressionEEE+0x34) [0x7fc3d1bfdec8]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_11DeclarationE+0x227) [0x7fc3d1c8c615]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass11Declaration7performEPNS_9OperationIPNS_9StatementEEE+0x32) [0x7fc3d1ba5d12]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6Expand12append_blockEPNS_5BlockE+0xe7) [0x7fc3d1c93d39]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_5BlockE+0x15b) [0x7fc3d1c8a359]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_9StyleRuleE+0x7b2) [0x7fc3d1c8abe4]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass9StyleRule7performEPNS_9OperationIPNS_9StatementEEE+0x32) [0x7fc3d1ba51ea]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6Expand12append_blockEPNS_5BlockE+0xe7) [0x7fc3d1c93d39]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_5BlockE+0x15b) [0x7fc3d1c8a359]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_9StyleRuleE+0x7b2) [0x7fc3d1c8abe4]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass9StyleRule7performEPNS_9OperationIPNS_9StatementEEE+0x32) [0x7fc3d1ba51ea]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6Expand12append_blockEPNS_5BlockE+0xe7) [0x7fc3d1c93d39]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_5BlockE+0x15b) [0x7fc3d1c8a359]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_9StyleRuleE+0x7b2) [0x7fc3d1c8abe4]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass9StyleRule7performEPNS_9OperationIPNS_9StatementEEE+0x32) [0x7fc3d1ba51ea]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6Expand12append_blockEPNS_5BlockE+0xe7) [0x7fc3d1c93d39]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_5BlockE+0x15b) [0x7fc3d1c8a359]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_9StyleRuleE+0x7b2) [0x7fc3d1c8abe4]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass9StyleRule7performEPNS_9OperationIPNS_9StatementEEE+0x32) [0x7fc3d1ba51ea]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6Expand12append_blockEPNS_5BlockE+0xe7) [0x7fc3d1c93d39]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_11Import_StubE+0x4b5) [0x7fc3d1c8e0fb]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass11Import_Stub7performEPNS_9OperationIPNS_9StatementEEE+0x32) [0x7fc3d1ba636e]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6Expand12append_blockEPNS_5BlockE+0xe7) [0x7fc3d1c93d39]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass6ExpandclEPNS_5BlockE+0x15b) [0x7fc3d1c8a359]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass7Context7compileEv+0x2d3) [0x7fc3d1c31fa5]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(_ZN4Sass12Data_Context5parseEv+0x470) [0x7fc3d1c31b2e]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(0x7fc3d1d801ff) [0x7fc3d1d801ff]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(sass_compiler_parse+0xb6) [0x7fc3d1d80f8b]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(0x7fc3d1d80765) [0x7fc3d1d80765]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/libsass.so(sass_compile_data_context+0xb9) [0x7fc3d1d80ccf]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.so(0x7fc3dbd0b886) [0x7fc3dbd0b886]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.so(0x7fc3dbd0b0fe) [0x7fc3dbd0b0fe]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.so(0x7fc3dbd0b17f) [0x7fc3dbd0b17f]
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.so(rbffi_CallFunction+0x1b9) [0x7fc3dbcfdae9] Call.c:400
/home/gdk/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.so(custom_trampoline+0x37) [0x7fc3dbd01b37] MethodHandle.c:220
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(vm_call_cfunc_with_frame+0x128) [0x7fc3e15669d8] vm_insnhelper.c:3037
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(vm_sendish+0x10) [0x7fc3e1574c82] vm_insnhelper.c:4751
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(vm_exec_core) insns.def:778
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(rb_vm_exec+0xd3) [0x7fc3e157a863] vm.c:2211
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(rb_yield+0x266) [0x7fc3e157fd76] vm.c:1316
/home/gdk/.asdf/installs/ruby/3.1.4/lib/libruby.so.3.1(RB_FL_TEST_RAW+0x0) [0x7fc3e12f23ee] array.c:2625
FLX-0x00 commented 5 months ago

Hey, I encounter another segmentation fault using latest gems and ruby 3.3.0. When try to precompile the assets of a rails app inside a docker container (ruby-3.3.0:alpine) I receive the following error:

40.33 $ sass ./app/assets/stylesheets/application.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules
42.01 Done in 1.74s.
42.29 /app/vendor/bundle/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc/functions_handler.rb:23: [BUG] Segmentation fault at 0x0000000000000000
42.29 ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux-musl]
42.29 
42.29 -- Control frame information -----------------------------------------------
42.29 c:0041 p:---- s:0253 e:000252 CFUNC  :initialize
42.29 c:0040 p:---- s:0250 e:000249 CFUNC  :new
42.29 c:0039 p:0015 s:0244 E:001e08 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc/functions_handler.rb:23 [FINISH]
42.29 c:0038 p:---- s:0236 e:000235 IFUNC 
42.29 c:0037 p:---- s:0233 e:000232 CFUNC  :each
42.29 c:0036 p:---- s:0230 e:000229 CFUNC  :each_with_index
42.29 c:0035 p:0059 s:0226 E:000038 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc/functions_handler.rb:22
42.29 c:0034 p:0202 s:0217 e:000216 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc/engine.rb:41
42.29 c:0033 p:0033 s:0205 e:000204 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb:29
42.29 c:0032 p:0007 s:0199 e:000198 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/sass_compressor.rb:30
42.29 c:0031 p:0047 s:0194 e:000193 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/processor_utils.rb:84
42.29 c:0030 p:0013 s:0186 e:000185 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/processor_utils.rb:66 [FINISH]
42.29 c:0029 p:---- s:0181 e:000180 CFUNC  :reverse_each
42.29 c:0028 p:0035 s:0177 e:000176 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/processor_utils.rb:65
42.29 c:0027 p:0395 s:0169 e:000168 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/loader.rb:184
42.29 c:0026 p:0054 s:0145 e:000144 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/loader.rb:59
42.29 c:0025 p:0033 s:0139 e:000138 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/loader.rb:339
42.29 c:0024 p:0115 s:0129 e:000128 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/loader.rb:43
42.29 c:0023 p:0006 s:0120 e:000119 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/cached_environment.rb:44
42.29 c:0022 p:0013 s:0117 e:000114 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/map.rb:207
42.29 c:0021 p:0033 s:0112 e:000111 METHOD /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/map.rb:187
42.29 c:0020 p:0010 s:0105 e:000104 METHOD /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/map.rb:206
42.29 c:0019 p:0008 s:0099 e:000098 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/cached_environment.rb:44
42.29 c:0018 p:0025 s:0094 e:000093 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/base.rb:81
42.29 c:0017 p:0023 s:0086 e:000085 METHOD /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/base.rb:88 [FINISH]
42.29 c:0016 p:---- s:0075 e:000074 CFUNC  :each
42.29 c:0015 p:---- s:0072 e:000071 CFUNC  :to_a
42.29 c:0014 p:0009 s:0068 e:000067 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/manifest.rb:125
42.29 c:0013 p:0010 s:0065 e:000064 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24
42.29 c:0012 p:0002 s:0061 e:000060 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.r [FINISH]
42.29 c:0011 p:---- s:0058 e:000057 CFUNC  :synchronize
42.29 c:0010 p:0016 s:0054 e:000053 METHOD /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.r
42.29 c:0009 p:0014 s:0050 e:000049 METHOD /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:22
42.29 c:0008 p:0015 s:0042 e:000041 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promise.rb:564
42.29 c:0007 p:0008 s:0036 e:000035 METHOD /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:3
42.29 c:0006 p:0041 s:0028 e:000027 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:3
42.29 c:0005 p:0018 s:0022 e:000021 METHOD <internal:kernel>:187
42.29 c:0004 p:0004 s:0017 e:000016 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:3 [FINISH]
42.29 c:0003 p:---- s:0014 e:000013 CFUNC  :catch
42.29 c:0002 p:0006 s:0009 e:000008 BLOCK  /app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:3 [FINISH]
42.29 c:0001 p:---- s:0003 e:000002 DUMMY  [FINISH]

I have tried to set the export_concurrent and try to not loading the rails app when doing precompile but without any success.

cesc1989 commented 3 months ago

As @stanhu suggested, I upgraded Sprockets gem to v4.2.1 and got it fix for me.

My setup: