Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

šŸ¤– bug: sharp image resize crashes Electron's Node runtime on headless Linux (SIGSEGV)

Open
#7,387 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
44/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
electron, linux, typescript

Research direction

Start by reading src/node/utils/attachments/resizeRasterImageAttachment.ts and the Linux Electron sharp note in src/node/workers/mcpIconDecode.ts. Reproduce with the two oversized fixtures under ELECTRON_RUN_AS_NODE=1, then verify on a real Linux desktop in a packaged build using attach_file. Done means oversized image resizing works without a crash; the payload suggests a plain Node worker or sharp's WebAssembly build as possible fixes.

Written by the indexing model from the issue text.

Description

Problem

On a headless Linux host, sharp crashes Electron when it resizes an image inside Electron's Node runtime. The process exits with SIGSEGV. The same script works under plain Node.

CAUTION: I saw this only under ELECTRON_RUN_AS_NODE=1 on a headless Linux host with no display. It happens with sharp 0.34.5 (main) and with sharp 0.35.5. I did not verify it on a real Linux desktop or in a packaged Linux build, so I do not know if desktop users hit it.

Steps (Electron 44.5.1, Linux x64, no DISPLAY)

  1. Build the main process: make build-main.
  2. Make two large fixtures (a 9001x10 PNG and a 10x9001 JPEG with EXIF orientation 6) with sharp under plain node.
  3. Run a script that calls resizeRasterImageAttachmentBufferIfNeeded from dist/node/utils/attachments/resizeRasterImageAttachment.js on both files:
    • node run.cjs prints oversized.png true 9001x10 -> 2000x2 image/png ... and the JPEG line, then exits 0.
    • ELECTRON_RUN_AS_NODE=1 node_modules/.bin/electron run.cjs prints .../node_modules/electron/dist/electron exited with signal SIGSEGV.
  4. ELECTRON_RUN_AS_NODE=1 node_modules/.bin/electron -e 'require("sharp")' alone does not crash. The crash comes when the image is processed.

The full desktop smoke path (MUX_ATTACH_FILE_SMOKE_TEST_PNG_PATH / MUX_ATTACH_FILE_SMOKE_TEST_JPEG_PATH with electron --no-sandbox --ozone-platform=headless dist/desktop/main.js) also exits with SIGSEGV after "App ready, creating window...". On this host that is not conclusive, because no X display exists.

New warning in sharp 0.35

With sharp 0.35.5, loading sharp in Electron on Linux prints:

[SharpElectronLinux] Warning: Binaries provided by Electron for use on Linux may be incompatible with sharp - see https://sharp.pixelplumbing.com/install#electron-and-linux

src/node/workers/mcpIconDecode.ts already notes a GLib symbol conflict between Linux Electron and native sharp for SVG. This crash is a guess at the same class of problem. I did not verify the cause.

What to check

  1. Run attach_file with an image larger than the resize limit in a packaged Linux build (AppImage or deb) on a real desktop.
  2. If it crashes, choose one fix: run the resize in a plain Node worker the way mcpIconDecode runs, or use sharp's WebAssembly build on Linux Electron.

Refs #7384 (sharp 0.35.5 bump).


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Dominant language
TypeScript
Stars
2.1k
Forks
140
Avg merge
5h 8m
Merged PRs (30d)
952

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coder/xum

All issues in coder/xum

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.