-
Notifications
You must be signed in to change notification settings - Fork 105
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
Segmentation fault on "RAILS_ENV=production assets:precompile" #122
Comments
Hi, could you make |
Hi, I have the same problem. test.css
but if I put that into an |
They already are .scss, i solved switching back to 'sass-rails' temporarily hoping the problem will get fixed soon. |
I encounter this with the follwoing @font-face
// If i comment out the following line, there is no segfault
src: asset-url('some_custom_font.woff') format('woff') It reminds me of this issue that caused a segfault whenever a pipeline helper was called.
EDIT This appeared after a bundle update, so I tried to find the culprit by upgrading the mentioned gems one by one. After I did that, the segfault now disappeared. Weird. But I'm happy now ;) EDIT2 I still have this problem, but intermittently. The problem disappears when I make modifications to SASS in another file, at some other place in the stylesheet assembly. If I make more changes, the problem is back. If I change something, it's gone again. I have not been able to reproduce it reliably though. |
I have this problem too, and it's hard to reproduce it. It happens unexpectedly with different projects and disappears, when I update any file used (just add blank line to any scss file, for example). And it doesn't appear again even after I remove that blank line. |
I am getting this segmentation fault consistently within the Rails project I am working on. It results from running: `NODE_ENV=production RAILS_ENV=production bundle exec dotenv 'bin/rails assets:precompile'. The dump/stack trace is attached. I am using:
|
I'm seeing the same issue when precompiling assets on deployment.
I only saw this issue after upgrading from sprockets 3.7.2 to 4.0.0. Revert back to sprockets 3.7.2 and the issue goes away. |
Same issue running
|
I had the same issue upgrading to
There is something that is told indirectly in the sprockets upgrading readme: # In your Rails configuration, prior to Sprockets 4
config.assets.precompile += ["marketing.css"] This kind of configuration is necessary only if you are using a prior version of Sprockets 4. The upgrading documentation is not warning about the need to remove those kind of lines, but at least in my case, removing them and adding that dependencies in the This post was very useful to understand the changes between versions. |
I've tried with with every permutation I can think of sassc and sass-rails with no love. using manifest.js already. works in dev, no clue why not in production. Attached the vomit from the crash. |
Also, just a note, this was all working on rails 6.0.1 with manifests and gemified assets so I'm sure they aren't the cause, which really make this perplexing for me. sassc I think is the only thing that changed. For some stupid reason I removed the version from my Gemfile. Looking through git for where it went wrong. |
Not getting a useful error msg and instead getting a segfault can be quite annoying. Is anyone from sassc-rails going to actually comment? OP filed in May, it's almost Dec. Is there anything you need from us to shed more light? How can we get help? |
@epipheus I think the problem is that nobody can reliably reproduce this error, so comments from the team won't help either. The only information everyone has is: sometimes it unexpectedly crashes and the next consequent time it works. |
Can I ask this? what's the difference between doing |
I get crashes for both development and production environments. The only difference is that dev crashes until I change any scss file, but for prod it crashes only once. |
hmm. i haven't flipped around to it working yet for me in production. Dev, no problem, as all. Even precompiles in dev without a hitch. which is super odd. OK, can I ask this, before we used sassc there are a pure ruby one right? took forever, but it existed I thought. How can we revert to that one? We should at least be able to fully trace right? |
I read somewhere there used to be a problem with concurrency for precompilation, the workaround of disabling concurrency didn't work for me and besides it's supposedly rolled into previous versions. I also went through and started taking out asset url helpers from my assets instead using scss variable and referencing from /assets. have asset references working in dev with that but still no precompilation love. I basically can't push needed changes to production because the deploy fails at asset compilation, which sucks. Anyone have any ideas? |
If after doing all this is still not working, you can force your project to use sprockets version 3.7.2 and it should work. |
Yes, using 4.0.0 and I moved to manifest.js when I upgraded to rails 6.0.1. I will try sprockets 3.7.2. Manifests work in sprockets 3? |
Tried 3.7.2 and it partially precompiled, most progress yet, but still crashed; do you know if there is a combination of sprockets with sprockets-rails and sassc and sassc-rails version voodoo that works in particular? |
I don't know if this is helpful, but I can tell you how I tracked down my problem. Maybe it will help you, because I'm my case it was a ridiculous needle in the haystack. I used gemified assets on my large projects so it was particularly hard to track down especially since other projects used the same pack of assets. I went old-school and forked sassc-ruby and printed debug messages before the offending line. Looking at my own segfault and others’, the offending line is almost always this line in the sassc-ruby engine I went old-school and printed a few debug messages before the offending line status = Native.compile_data_context(data_context) As for instance variable, in my case:
Sadly the only useful instance variable seems to be I don’t have much experience binding C and Ruby but seems to me that we need to wrap sassc-ruby’s line: status = Native.compile_data_context(data_context) with something that can fail gracefully (?). Also why aren’t file names non-empty/present? That would help people tremendously to have a mode like Lastly, given css is a subset of scss, would it be a bad idea to import all css as scss/sass, expecially if |
You went much deeply with the error than me... AFAIK, although the segmentation fault occurs in sassc-rails, I suspect that the problem starts earlier in sprockets and some kind of corner case of incompatibility with this sassc. If you see the file you shared ( precompile.out.txt ) before starting with sassc it was on I am sorry to not having a technical explanation about the problem, but I could fix the problem with two different ways:
For us, both options worked, so we decided to go with the second one because it was using sprockets 4. But the easiest way to fix this issue is to downgrade to sprockets 3.7.2. |
Ahh, well I guess my segfault location changed. downgrading to 3.7.2 partially worked for me but it crash at like 42 of the sassc-ruby engine, which seems to also be the location of the OP's (@icra-zz) segfault as well.
I think my point here is that there probably is a way to eliminate a fair percentage of these with simply a message stating which asset we're on in the process when it fails. There are probably only a few choke points, with compilation likely being the major one. Is there not a way to try a ffi C function? And btw, finding this needle in the haystack meant being able to use the latest version of all the component without a hitch. And I moderately stressed precompilation to see if it would appear again, it hasn't. It might not be sprocket's fault at all; it's possible, perhaps it's the joints and not the meat, so to speak. I would bet, many of the segfaults die at line 42. of those that fall there a large percent probably could be completely eliminated by importing css as scss (certainly eliminates having helpers blow things up). I don't know about you guys but my large apps have a ton of assets. finding that needle is a real pain without basic information. |
I think it's not directly connected with the contents of assets. If I'll find time, I'll try to reproduce this with almost empty scss like |
thanks. |
No wait dude, this is exactly what I described.
This is exactly what's I've just described. Changing it to scss is what makes it ok. I love to blame sprockets too, but I just don't think it is.
|
Yep, I commented this issue some months ago in this thread #122 (comment). This possibility was declined, but anyway, in my case, it worked after amending the assets.precompile line in favour of manifest.js. |
This fixes a segmentation error in circle ci after upgrading to rails 6 this is when the docker file runs assets:precompile sass/sassc-rails#122 The error can be found above
This fixes a segmentation error in circle ci after upgrading to rails 6 this is when the docker file runs assets:precompile sass/sassc-rails#122 The error can be found above
Update Rails to version 6.0.2 Downgrage sprockets to 3.7.2. This fixes a segmentation error in circle ci after upgrading to rails 6 this is when the docker file runs assets:precompile sass/sassc-rails#122
Update Rails to version 6.0.2 Downgrage sprockets to 3.7.2. This fixes a segmentation error in circle ci after upgrading to rails 6 this is when the docker file runs assets:precompile sass/sassc-rails#122
Update Rails to version 6.0.2 Downgrage sprockets to 3.7.2. This fixes a segmentation error in circle ci after upgrading to rails 6 this is when the docker file runs assets:precompile sass/sassc-rails#122
Update Rails to version 6.0.2 Downgrage sprockets to 3.7.2. This fixes a segmentation error in circle ci after upgrading to rails 6 this is when the docker file runs assets:precompile sass/sassc-rails#122
Update Rails to version 6.0.2 Downgrage sprockets to 3.7.2. This fixes a segmentation error in circle ci after upgrading to rails 6 this is when the docker file runs assets:precompile sass/sassc-rails#122
After adding (and downgrading at same time) |
I had this issue but then realized why I was getting it - I forgot to remove my assets from |
Same as @jnettome After adding (and downgrading at same time) gem 'sprockets', '3.7.2' to my Gemfile, on my Rails 6 app, it works again. 👊 |
Had a similar problem in production mode but a working development mode.
Hope this helps |
My assets files were a mixture of files with the .css extension. |
Hello, I'm facing the same issue and this workaround also solved the problem on my Rails 6 app. However I can't help thinking this is not a "clean" fix, since we downgrade on purpose a relatively important dependency of our app. I have not enough knowledge / experience to judge this, so if anyone has a piece of advice about that I'd be glad ! |
Various suggestions to downgrade sprockets to fix a segfault crash: sass/sassc-ruby#207 sass/sassc-rails#122 rails/sprockets#633 We'll see if that fixes it for us. Refs: #2872
Various suggestions to downgrade sprockets to fix a segfault crash: sass/sassc-ruby#207 sass/sassc-rails#122 rails/sprockets#633 We'll see if that fixes it for us. Refs: #2872
We had this pinned to version 3.7.2 because of a segmentation fault that occurred when upgrading to 4.0+ After investigation it seems that Sprockets now uses the manifest.js file to compile assets instead of the assets.rb file. See: sass/sassc-rails#122 and https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs This commit upgrades Sprockets and now uses the manifest.js file to precompile assets which ensures the segmentation fault no longer occurs.
We had this pinned to version 3.7.2 because of a segmentation fault that occurred when upgrading to 4.0+ After investigation it seems that Sprockets now uses the manifest.js file to compile assets instead of the assets.rb file. See: sass/sassc-rails#122 and https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs This commit upgrades Sprockets and now uses the manifest.js file to precompile assets which ensures the segmentation fault no longer occurs.
/home/icra/.gem/ruby/2.5.0/gems/sassc-2.0.1/lib/sassc/engine.rb:42: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
-- Control frame information -----------------------------------------------
c:0065 p:---- s:0385 e:000384 CFUNC :compile_data_context
c:0064 p:0298 s:0380 e:000379 METHOD /home/icra/.gem/ruby/2.5.0/gems/sassc-2.0.1/lib/sassc/engine.rb:42
--- EDIT ----
Excluding CSS files one by one i discovered the problem is my "style.css", but it has no errors, and the stacktrace is not appointing it so i can understand the error.
The CSS compiles well on another project using same version of sass-c. I tried creating a new rails app and it still crashes.
The text was updated successfully, but these errors were encountered: