-
Notifications
You must be signed in to change notification settings - Fork 193
Segfault with Musl-LibC on MRI inside of Alpine Linux. #378
Comments
@envygeeks Thanks for submitting this bug. We're currently working on the next version of the ruby racer that should address instability issues such as this. If you could outline the steps you took to generate this error, I'd be eager to include it into the regression suite in order to make sure that it does not happen again. |
Gonna CC @SamSaffron and @eviltrout ... even though they don't support Alpine Linux as a Docker image (or any Docker image that is not their own) they can provide inside into what their code is doing so I can build a re-production script without the need to install full Discourse to trigger it. |
As a sidenote @cowboyd I would love to try the new version if it's available. |
It can be found here #348 It should be noted that large portions of the API remain either omitted or broken. That said, it can do basic javascript evaluation. Here is the parts of the test suite that are currently passing https://github.com/cowboyd/therubyracer/blob/upgrade-to-v8-4.5/spec/v8/context_spec.rb |
Also having trouble on Alpine Linux. I get a load error because of missing symbol:
|
@ignisf possibly it did:
I tried doing this:
Didn't seem to have any effect. |
As far as I see, Alpine provides v8 3.26. I am almost certain that they changed v8's API several times between 3.16 and 3.26 :(. |
(also, remove the use system libraries switch from the bundle config beforehand) |
You need to use |
The whole point of skipping the latter is to get therubyracer to compile it's bundled v8 with musl. |
@envygeeks actually I got it compiling and working on Alpine with no switches at all. I just set a source only version in the Gemfile as suggested here. |
The argument is so you don't have to rely on all that. How about you provide more information instead because the broad statements made provide me with no way to validate this so we can release Alpine images with rubyracer. Such as: Versions, musl version, Alpine version (we use edge here and only edge...) are you sure it actually compiled and works as you think it does? The latter part isn't me trying to say you don't know how it works, it's me saying, it was a week before we could reliably trigger a segfault on Alpine. |
Sure. The only thing I know is that in our case it compiles and all specs pass in a relatively large Rails app (using source only versions of libv8 as previously suggested). Whether it will segfault in a week I can't say. Here's some more info:
So, no we're not using edge Alpine. |
Hmmmm... that's the same versions we tried with our Discourse image that ended up segfaulting on Musl here is where we get the segfault: https://github.com/discourse/discourse/blob/a8edc982762d14bd01dc0b2964909c1fb6103deb/lib/pretty_text.rb#L176 I will try to recompile today. |
@envygeeks You're right about that segfault. We get it too when compiling assets. |
We're on ruby:
From rbenv in our case. |
Interestingly I get segmentation faults on Ubuntu now as well, possibly since locking the version to one that always compiles from source. |
Here's what I get on Ubuntu:
|
any update on this about the fix to get alpine and rubyracer playing together ? |
same error, any updates on this ? |
I'd recommend using the |
@cowboyd we do! We switched to mini_racer for both Discourse and our own for musl-c based builds. |
@envygeeks any issues with libv8? |
@cowboyd switching to mini_racer, and less still require therubyracer to compile assets, how to make less work with mini_racer ?
|
Less should use execjs and then this would not be a problem On Tuesday, 14 June 2016, Dylan Wang [email protected] wrote:
|
Uh.. Less not using execjs seems to be a known issue... cowboyd/less.rb#11 |
@ignisf @SamSaffron yeh, I have node and execjs but none of them working with less |
Ok, I'm getting the same segfault (I guess). Seems it comes up when trying to compile the uglifier gem (Full error message)
Steps to reproduce:
Alternatively it is possible to reproduce the problem by just evaluating the uglifier source - see linked gist. I've narrowed down the problem to the last 430 lines of code or so. Everything compiles fine, and evaluating js also works fine for "normal" cases... |
@envygeeks How did you get mini_racer installed on alpine? It requires libv8 v5.x, which I can't get to build on alpine, do to weird problems like this:
And before you point out the obvious: Yes, the system has a network connection. The git command succeeds fine when run in a command line on its own. |
Solving this might help: rubyjs/libv8#221 |
@averell23 we package our own v8 for our Alpine and Ubuntu images because v8 lags considerably on most distro's. |
@envygeeks you don't have a link to a Dockerfile by any chance? ;-) |
@envygeeks, are you able to share your script for building v8 on Alpine linux? |
i'm guessing @envygeeks switched to ubuntu as base image rather than actually fixing it on alpine seeing a pattern of ppl giving up on alpine and using ubuntu instead:
|
@sbimikesmullin that's our public image, https://talk.jekyllrb.com uses a private Alpine image we've not made public yet that uses @SamSaffron's bad ass Miniracer as much as it can with some patches in a few places (though I hear 1.7? Can't remember which version it started in) uses MiniRacer partially already. |
@envygeeks, I'm glad to hear that mini_racer with the fresher version of libv8 work on Alpine!. I'm still unable to automate testing on it :/. You should be taking the HEAD version of mini_racer for a spin, too. Now would be a great time to do so, as they're gearing up for a release. |
Did anyone find a workaround for this issue? I'm trying to run
|
Hello @strund3r, The error you are experiencing is due to |
Hey @ignisf, We're running into some problems with this too. Would you be interested in sponsorship to get therubyracer working on Alpine? |
Just wanted to contribute what i've learned today while researching this issue, seems it is possible, and there are some current docker images you can base from.
Both built Looking at the latter:
Hopefully this helps some people out/saves some headaches! |
@alias1 FYI, we also had a basic v8 setup working in alpine based on the above, but we're getting segfaults when trying to use more complex JS libs - aka less-rails. If someone has that working correctly, I'd be super interested. In the meantime we're using a fork of less.rb call less-execjs and adding some of our own code to integrate w/ sprockets/rails. |
for noobs like me: we basically settled on two base images that are already working:
and
together with a script called
don't ask me how it works, i don't actually know. but if you're like we were just trying to build your own from-scratch container for alpine and node.js, this may be a time saver. for static bindings, we took to building dependencies (like npm modules and ruby gems) INSIDE the container, using an if you're hardcore and intent on working out the specific details unaddressed here, disregard this reply. |
@mwarkentin Yup.. I see your pain now.. have just hit the same issue myself :p |
k, so I have some updates. I've released a prerelease version of libv8 5.7 (compatible with mini_racer) that runs on Alpine (cc @strund3r). Still one needs to use a source version. I've taken a look at v8 3.16 on Alpine as well. I'm getting a SEGFAULT during the build process. More precisely -- in the
The worst part is that this is a heisenbug that disappears whenever I enable debugging. :( |
Yeap... Can confirm If you need to use trr in a project on Alpine, for the time being my workaround is: Gemfile: gem 'libv8', '= 3.16.14.18'
gem 'therubyracer' Then, execute Any suggestions on the SEGFAULT in release mode are welcome. I'm out of ideas for now... 😟 As a side note, trr cannot be compiled with Ruby from rbenv on Alpine:
|
Hi everyone, I was looking if there was anything new about this issue and I found this: I didn't try it yet, but, maybe, can it be of some help? |
@strund3r honestly a much better effort is migrating to mini_racer which should work on alpine It is a gigantic effort to update trr to latest libv8 as it stands it is the equivalent of running Chrome 31 that was released 2013-11-12 |
@strund3r I tried alpine-pkg-glibc and I had no luck with ruby-2.3.1 alpine 3.4 therubyracer 0.12.3 and libv8 3.14.16.19. |
I recently needed to get a Rails app running on Docker with Alpine 3.7 (Ruby 2.3.6) and encountered the issue described here, and had pretty much thrown in the towel and decided that the debug build of libv8 was the best I could do. But after chasing down some references based on where
There are other ways to do it, but the way I passed these flags was as part of my
Although it will likely incur some performance penalty as opposed to |
@cowboyd I probably recommend for the time being just to close all the bugs on TRR and say it is no longer supported in the README, less work for everyone. Its quite risky having this out there cause the v8 version it runs is so old and full of published security holes. |
Just want to point out that on Ubuntu 22.04.2 LTS, under WSL2 running on Win11 on an Intel CPU, all attempts to install therubyracer fail to compile, and this random segfualt when trying to compile is the core active blocker on the ability to upgrade to newer rails versions. TheRubyRacer was core to rails at one point, so a lot of apps depend on getting a working install, even to upgrade them out of using it. If people are not able to install it, they cant update away from it. Congrats, You have broken the rails upgrade path. Thing is, Ubuntu doesnt even use Muscl, so this issue is not just just a Muscl issue. |
The text was updated successfully, but these errors were encountered: