Skip to content

build: stabilize image optimization against EAGAIN/EPIPE failures#1112

Open
RaminNietzsche wants to merge 1 commit into
ceph:mainfrom
RaminNietzsche:fix/assets-imagemin-stability
Open

build: stabilize image optimization against EAGAIN/EPIPE failures#1112
RaminNietzsche wants to merge 1 commit into
ceph:mainfrom
RaminNietzsche:fix/assets-imagemin-stability

Conversation

@RaminNietzsche

Copy link
Copy Markdown

Summary

Fixes intermittent npm start and npm run build failures caused by
imagemin spawning too many pngquant / mozjpeg child processes at
once (EAGAIN on macOS, EPIPE on some JPEGs).

Problem

  • scripts/images.js optimized all ~1400 images in a single imagemin()
    call and wrote outputs with un-awaited forEach(async …)
  • npm run dev ran assets in parallel with Eleventy, CSS, and Rollup,
    increasing process spawn pressure
  • A handful of event JPEGs fail mozjpeg with EPIPE; the whole build
    exited with code 1

Changes

scripts/images.js

  • Process images in batches of 8
  • On batch failure, retry file-by-file
  • On single-file failure, copy the original to dist/ (with warning)
  • Use fs/promises and path.join (no undeclared make-dir / graceful-fs)

package.json

  • dev: run assets before --serve (not in parallel with Eleventy)
  • build: run assets after parallel site css js

Related PRs

Overlaps with open #994 (imagemin EPIPE), but this change is scoped to
the asset pipeline only — no footer / Twitter icon changes.

Process images in bounded batches with per-file fallback so npm start
and npm run build no longer crash when pngquant/mozjpeg spawn limits
are hit. Run assets before the dev server and after the parallel
site/css/js build to reduce concurrent process pressure.

Co-authored-by: Cursor <cursoragent@cursor.com>
@RaminNietzsche RaminNietzsche requested a review from a team as a code owner June 14, 2026 05:51
@ceph-jenkins

Copy link
Copy Markdown

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants