thoughtbot / administrate

A Rails engine that helps you put together a super-flexible admin dashboard.
http://administrate-demo.herokuapp.com
MIT License
5.9k stars 1.12k forks source link

Flaky specs due to sassc "Segmentation fault" errors #2130

Closed jordan-brough closed 7 months ago

jordan-brough commented 2 years ago

The Ruby 2.6 & 2.7 tests seem to have suddenly become flaky: image

I saw some failures like that in a couple of my PRs, that usually went away if I retried the specs (e.g. by pushing an empty commit).

It might be something from one of my recent commits? It doesn't look like they were flaky before that, unless y'all have already been retrying failures like that on master branch when they happened?

Example failure: https://app.circleci.com/pipelines/github/thoughtbot/administrate/1662/workflows/238e328c-cdd2-4f65-ae6a-24f9789c20c4/jobs/8803

Some example outputs:

>> BUNDLE_GEMFILE=/home/circleci/administrate/gemfiles/rails61.gemfile bundle exec rspec

Randomized with seed 48932
..................../home/circleci/administrate/gemfiles/vendor/bundle/ruby/2.7.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
>> BUNDLE_GEMFILE=/home/circleci/administrate/gemfiles/rails52.gemfile bundle exec rspec
warning: parser/current is loading parser/ruby26, which recognizes2.6.9-compliant syntax, but you are running 2.6.3.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

Randomized with seed 24433
............/home/circleci/administrate/gemfiles/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
>> BUNDLE_GEMFILE=/home/circleci/administrate/gemfiles/rails60.gemfile bundle exec rspec
warning: parser/current is loading parser/ruby26, which recognizes2.6.9-compliant syntax, but you are running 2.6.3.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

Randomized with seed 52838
............................................................................/home/circleci/administrate/gemfiles/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
>> BUNDLE_GEMFILE=/home/circleci/administrate/gemfiles/rails60.gemfile bundle exec rspec

Randomized with seed 42679
............................................................................/home/circleci/administrate/gemfiles/vendor/bundle/ruby/2.7.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
jordan-brough commented 2 years ago

FYI I tried to repro the failure from this one by running the following locally, but I wasn't able to reproduce the error:

rm -r gemfiles/*.lock

export RBENV_VERSION=2.7.5

bin/setup

bundle exec rspec --seed 3813

bundle exec appraisal install

BUNDLE_GEMFILE=gemfiles/rails50.gemfile bundle exec rspec --seed 38463
BUNDLE_GEMFILE=gemfiles/rails51.gemfile bundle exec rspec --seed 18633
BUNDLE_GEMFILE=gemfiles/rails52.gemfile bundle exec rspec --seed 3575
BUNDLE_GEMFILE=gemfiles/rails60.gemfile bundle exec rspec --seed 42679 # This one failed in Circle with a segfault
jordan-brough commented 2 years ago

If this is something that has occasionally happened in the past, then it could be that some of the extra flakiness is due to the fact that we're now running more tests on Circle, due to #2125 being merged?

jordan-brough commented 2 years ago

I verified that for the example in my comment above (the "FYI I tried to repro the failure ..." one) that the test that segfaulted was the first feature test run for that commit + seed value. And the stack trace shows it's executing some sprockets and concurrent-ruby code.

I wonder if any of the comments in https://github.com/sass/sassc-ruby/issues/207 are applicable?

nickcharlton commented 2 years ago

Hmm, interesting. I've seen this in the past and it seems much worse now.

I just pushed up this branch with a potential solution. I'm going to run it a few times and see how it behaves on CI: https://github.com/thoughtbot/administrate/compare/nc-sassc-seg-fault-fix?expand=1

gathuku commented 2 years ago

I have an app that I have been to upgrade to cssbundling-rails. Unfortunately, I have faced the Segmentation fault errors. After trying everything with no success I want to get rid of the sassc-rails gem. Is it possible to run administrate without this gem?

nickcharlton commented 2 years ago

That branch did no good and I'm not necessarily convinced that spending much time on it is worthwhile.

@gathuku, hmm, good question. I don't see why you wouldn't in principle be able to do so. But you might need to fork the gem and change the dependencies around so that it's never bundled.

pablobm commented 7 months ago

With https://github.com/thoughtbot/administrate/pull/2397 merged, we are not using sassc any more. I think this should be fixed...?

If not let us know and we'll reopen.