-
Notifications
You must be signed in to change notification settings - Fork 60
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 #264
Comments
Oh dear, that's very bad. Could it be a change in the ffi gem? That's the only other thing that ruby-vips depends on. |
I made a simple dockerfile which runs ruby-vips on fedora33: https://github.com/jcupitt/docker-builds/tree/master/ruby-vips-fedora33 It seems to work for me. I see:
And it makes a thumbnail. Do you have an image which it fails for? You could also write your thumbnail line as:
I expect you know. |
I don't even get a segmentation fault but the application will just freeze. As @da2x described, everything worked fine some week before. Using ActiveStorage to store/resize image. After running with a debugger, I found that it'll break here:
# line 211
op = Vips.vips_cache_operation_build self It did not work for
I tested several ffi and ruby-vips versions (and combinations). The last command is always before it freezes:
It might have something to do with vips on mac os. Still I wanted to give an update here. |
Thank you for the report, I'll see if I can reproduce this on my mac. |
I updated everything (macos, dev tools, brew, took a while, ouch) and it seems to work for me. I see:
My test image is here, in case that's a factor: http://www.rollthepotato.net/~john/nina.jpg This is a 2012 intel mac on 10.15.7. |
We test and fuzz libvips on macos, eg: https://github.com/libvips/libvips/runs/3873107160?check_suite_focus=true So it shouldn't be a libvips-on-macos issue. How are you installing ruby? |
Installed it via The behavior seems to rely on the image files itself. Some images causing no problems. We tested the breaking images on other systems (linux) and they work. They are always the same images causing the problem. |
Oh, that's interesting. Could you share one of these breaking images? |
Just two examples... |
I tried your image with brew ruby and it seems to work:
Is that what triggers the crash for you? |
I tried with rbenv 2.7.4 as well and that also worked:
How are you triggering the crash? Is this just in rails? |
I think I just bumped into this on production. The file in question is a bog-standard 1.7MB 3088x2316px JPEG, but we're seeing it for multiple different files of varying types. We're seeing a segmentation fault occurring in
This is on Heroku (stack 20 - Ubuntu 20.04), we're using these buildpacks:
|
This turned out to be an issue with our vips dependencies, this fixed it: diff --git a/Aptfile b/Aptfile
index 73561db1f..1d7617804 100644
--- a/Aptfile
+++ b/Aptfile
@@ -1 +1,3 @@
-libvips
\ No newline at end of file
+libglib2.0-0
+libglib2.0-dev
+libpoppler-glib8
\ No newline at end of file |
Hi @developius, I'm glad it's fixed, but I'm puzzled how this change resolved the issue. You'd think no processing could happen with missing libraries. Were you seeing unreliable image handling, or no image handling? |
@jcupitt apologies for the slow response here. I can't quite recall, but it did feel intermittent to me, although I'm now wondering if that was because some variants had already been generated some other way. I was messing with dependencies at the time, so it's possible that one setup worked for a time, then I switched to one which didn't. That would give me some images which were already processed, plus some which weren't, perhaps making it look intermittent. Not sure any of that is particularly helpful, but wanted to close the loop on my experience. |
I wonder if vips could automatically (if you turn on some option) add metadata to image file which exactly version was used to generate it. |
I am having the same issue, also on Heroku 20 and using it via ActiveStorage, and I can confirm it's intermittent, some thumbnails work, some other don't. |
If you have an image which always fails, that'd be great! If it seems random, this will be much harder to find :( Are you using Brandon's libvips? https://elements.heroku.com/buildpacks/brandoncc/heroku-buildpack-vips I'd recommend that over the official heroku libvips. |
We do have an image which always fail, but unfortunately, it's an identity picture, so we can't share it. I've done some investigations, and more specifically, the segfault occurs when I try to do an autorot on this image (I used the code below)
With the buildpack, the issue is no longer there, therefore, I suspect that the latest version of vips fixes the issue. I would like to try on heroku-22 to see whether that fixes the issue (since vips is at an higher vips8.12.1-1build1 version, compared to heroku-20's vips version 8.9.1-2), but we have to upgrade our version of ruby for that. I'll try the test again once our codebase upgrade will be done. |
Could you please tell me if anyone has solved the problem? Still relevant to
|
I've never been able to reproduce this problem, so I've not been able to investigate, sorry :( If someone can provide a dockerfile plus a sample image that triggers a crash, that would be wonderful. |
Segmentation fault on almost all images that are downscaled with e.g,
Vips::Image.thumbnail('source.png', 1920, height: 1080, **{crop: 'centre', size: :down})
. Some images work if I remove the height parameter, but there’s still a large number that fail. All the same images worked just fine on this system two weeks ago.I tried downgrading from ruby-vips 2.0.17 (released today) to ruby-vips 2.0.16, but it still fails. I’m really not sure what else has changed on my environment over the holidays.
The text was updated successfully, but these errors were encountered: