-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SIGSEGV after a random number of sharp calls on Electron + Artix Linux x64 #3082
Comments
Using the second-latest version of this package without the precompiled On the other hand, downloading your second-latest precompiled Since we're talking precompiled things, probably it's a good thing to mention that my system runs on GLibc version 2.33 |
Hi, thank you for the detailed report, I've been able to reproduce this on Ubuntu 20.04 using recent prebuilt electron binaries (v15 to v17) and prebuilt sharp/libvips binaries (v0.28.3 to v0.30.0). As you say, this works as-expected when using Node.js itself, so there must be something different about electron that's causing or triggering this. I too can confirm there's no problem when using libvips as a globally-installed shared library. In the past we've seen symbol clashes between the (many) shared libraries upon which electron on Linux depends and statically-linked libraries inside the prebuilt ldd electron$ ldd /tmp/node_modules/electron/dist/electron linux-vdso.so.1 (0x00007fffdcdfe000) libffmpeg.so => /tmp/node_modules/electron/dist/libffmpeg.so (0x00007ff7d6c17000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff7d6bf8000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff7d6bd5000) libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007ff7d6bcf000) libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff7d6b6f000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff7d6a46000) libxshmfence.so.1 => /lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007ff7d6842000) libgio-2.0.so.0 => /lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007ff7d6661000) libnss3.so => /lib/x86_64-linux-gnu/libnss3.so (0x00007ff7d6512000) libnssutil3.so => /lib/x86_64-linux-gnu/libnssutil3.so (0x00007ff7d64df000) libsmime3.so => /lib/x86_64-linux-gnu/libsmime3.so (0x00007ff7d64af000) libnspr4.so => /lib/x86_64-linux-gnu/libnspr4.so (0x00007ff7d646f000) libatk-1.0.so.0 => /lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007ff7d6443000) libatk-bridge-2.0.so.0 => /lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0 (0x00007ff7d640c000) libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007ff7d63bb000) libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x00007ff7d63a7000) libgtk-3.so.0 => /lib/x86_64-linux-gnu/libgtk-3.so.0 (0x00007ff7d5bf6000) libpango-1.0.so.0 => /lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007ff7d5ba7000) libcairo.so.2 => /lib/x86_64-linux-gnu/libcairo.so.2 (0x00007ff7d5a82000) libgdk_pixbuf-2.0.so.0 => /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007ff7d5a5a000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff7d590b000) libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff7d57ce000) libXcomposite.so.1 => /lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007ff7d57c9000) libXdamage.so.1 => /lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007ff7d57c4000) libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007ff7d57ad000) libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007ff7d57a5000) libXrandr.so.2 => /lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007ff7d5798000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff7d576a000) libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff7d5740000) libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007ff7d56fe000) libgbm.so.1 => /lib/x86_64-linux-gnu/libgbm.so.1 (0x00007ff7d56eb000) libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x00007ff7d55f0000) libatspi.so.0 => /lib/x86_64-linux-gnu/libatspi.so.0 (0x00007ff7d55b9000) libcups.so.2 => /lib/x86_64-linux-gnu/libcups.so.2 (0x00007ff7d551e000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff7d5503000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff7d5311000) /lib64/ld-linux-x86-64.so.2 (0x00007ff7dfc70000) libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007ff7d5303000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff7d5290000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff7d5274000) libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007ff7d5214000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007ff7d51e9000) libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007ff7d51cd000) libplc4.so => /lib/x86_64-linux-gnu/libplc4.so (0x00007ff7d51c4000) libplds4.so => /lib/x86_64-linux-gnu/libplds4.so (0x00007ff7d51bf000) libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007ff7d5110000) libgdk-3.so.0 => /lib/x86_64-linux-gnu/libgdk-3.so.0 (0x00007ff7d500b000) libpangocairo-1.0.so.0 => /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007ff7d4ff9000) libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x00007ff7d4fe5000) libcairo-gobject.so.2 => /lib/x86_64-linux-gnu/libcairo-gobject.so.2 (0x00007ff7d4fd9000) libepoxy.so.0 => /lib/x86_64-linux-gnu/libepoxy.so.0 (0x00007ff7d4ea6000) libfribidi.so.0 => /lib/x86_64-linux-gnu/libfribidi.so.0 (0x00007ff7d4e89000) libpangoft2-1.0.so.0 => /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007ff7d4e70000) libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007ff7d4d6b000) libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff7d4d22000) libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff7d4c63000) libthai.so.0 => /lib/x86_64-linux-gnu/libthai.so.0 (0x00007ff7d4c58000) libpixman-1.so.0 => /lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007ff7d4bb1000) libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007ff7d4b79000) libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007ff7d4b72000) libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007ff7d4b63000) libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007ff7d4959000) libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff7d4953000) libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff7d494b000) libwayland-server.so.0 => /lib/x86_64-linux-gnu/libwayland-server.so.0 (0x00007ff7d4933000) libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007ff7d48e6000) libavahi-common.so.3 => /lib/x86_64-linux-gnu/libavahi-common.so.3 (0x00007ff7d48d8000) libavahi-client.so.3 => /lib/x86_64-linux-gnu/libavahi-client.so.3 (0x00007ff7d48c5000) libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007ff7d46ef000) libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007ff7d4696000) libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007ff7d4606000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff7d45fb000) liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007ff7d45d2000) liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007ff7d45b1000) libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007ff7d4493000) libXinerama.so.1 => /lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007ff7d448c000) libXcursor.so.1 => /lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007ff7d447f000) libwayland-cursor.so.0 => /lib/x86_64-linux-gnu/libwayland-cursor.so.0 (0x00007ff7d4474000) libwayland-egl.so.1 => /lib/x86_64-linux-gnu/libwayland-egl.so.1 (0x00007ff7d446f000) libwayland-client.so.0 => /lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007ff7d445e000) libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007ff7d442f000) libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ff7d4426000) libdatrie.so.1 => /lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007ff7d441c000) libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007ff7d4402000) libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007ff7d4325000) libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007ff7d42f2000) libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007ff7d42eb000) libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007ff7d42dc000) libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007ff7d41a6000) libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007ff7d4185000) libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x00007ff7d4003000) libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007ff7d3feb000) libnettle.so.7 => /lib/x86_64-linux-gnu/libnettle.so.7 (0x00007ff7d3fb1000) libhogweed.so.5 => /lib/x86_64-linux-gnu/libhogweed.so.5 (0x00007ff7d3f7a000) libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007ff7d3ef6000) libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007ff7d3ed3000) libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007ff7d3eca000) The fact that electron can run quite happily for a minute or so before crashing seems more like a memory or garbage collection problem. The next step is probably to create a debug build of the binary created by http://github.com/lovell/sharp-libvips so we can get a proper backtrace of the crash. |
Yeah, I've tried but I can't use docker myself. Been trying to compile it without docker in my host system with no success. I am at a loss, but if you manage to do that I will be super happy if you shared the lib with me so I can make my own testing as well. Also, I've been force refreshing this page for hours now, does it show? |
GDB backtrace with debugging symbols:
PR #3083 seems to fix this for me. You can test this with:
Or with Yarn:
|
@kleisauke I use Yarn for my projects; any way to achieve the same effect with that? |
I've updated my comment with installation info for Yarn. |
Sadly, Yarn doesn't expose commandline arguments to lifecycle scripts, so I need another way. I will follow this comment with a working Yarn command, for reference, if I am lucky to find it |
I think you could use the |
I am leaving it running for a couple of minutes; if it doesn't crash, then nice work |
It works! Hope it makes into a release soon enough, so I can ship an update to my app in time |
Thanks Kleis, amazing work. Do we know why electron exposed this? Different stack size? |
I'm not quite sure why this was only a issue on Electron. It looks like a memory corruption issue, since I couldn't reproduce this when I set the |
FWIW, https://gitlab.gnome.org/GNOME/glib/-/issues/1079#note_991535 mentions a similar backtrace. |
Here's is a simple reproducer without Electron: G_SLICE=debug-blocks LD_PRELOAD=/lib64/libgobject-2.0.so.0 node test.js GDB backtrace:
|
v0.30.1 now available with the fix, thanks both. |
Are you using the latest version? Is the version currently in use as reported by
npm ls sharp
the same as the latest version as reported bynpm view sharp dist-tags.latest
?Sharp v.
0.30.0
.What are the steps to reproduce?
Grab a WebP image (for example, a Youtube video thumbnail) and try to convert it to PNG again and again and again in a bunch of async/await method calls.
(so useful indeed! but I know it's libvips from here)
The kernel just writes it off as a general protection fault:
What is the expected behaviour?
Sharp handles all conversions without ever crashing, no matter how fast or how many concurrent calls there are.
Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
Run this under Electron! Vanilla Node.js doesn't have this bug.
Are you able to provide a sample image that helps explain the problem?
https://i.ytimg.com/vi/ntUIv5pVC4Q/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLANZDELfwLQvLXJDP1uJd8_hcPUBg
What is the output of running
npx envinfo --binaries --system
?By the way, it says I run in a container, but I definitely am not. That's a bug in and of itself in
envinfo
I guess.I am also using Electron v16.0.6
EDIT: Updated to 17.0.0 and this issue is still happening
The text was updated successfully, but these errors were encountered: