cheeaun / cheeaun/phanpy

Building in node:26-alpine container too many open files error

Open Beginner friendly
#1,593 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.5k
Forks
186
Avg merge
1d 36m
Merged PRs (30d)
11

Description

I'm using a node:26-alpine container to build Phanpy and running into a open file limit for the container image because of this fs.writeFile/Promise.all

https://github.com/cheeaun/phanpy/blob/53dcfc3190005796b4bbeff3b44812b9a3490491/scripts/generate-icons.js#L24

I'm avoiding this by increasing the open file limit by passing into my container build command `--ulimit nofile=65536:65536`.

I looked for ways to batch this out but it seemed unnecessarily complicated for an underlying container specific limit but sharing the issue here in case others run into it. Here's the error message it produces:

```
> phanpy@0.1.0 postinstall
> node scripts/generate-icons.js && npx exifreader build

node:internal/fs/promises:1387
return new FileHandle(await PromisePrototypeThen(
^

Error: EMFILE: too many open files, open '/phanpy/src/iconify-icons/mingcute/dots-line.js'
at async open (node:internal/fs/promises:1387:25)
at async Object.writeFile (node:internal/fs/promises:2116:14)
at async Promise.all (index 1007)
at async file:///phanpy/scripts/generate-icons.js:24:1 {
errno: -24,
code: 'EMFILE',
syscall: 'open',
path: '/phanpy/src/iconify-icons/mingcute/dots-line.js'
}

Node.js v26.8.1
npm error code 1
npm error path /phanpy
npm error command failed
npm error command sh -c node scripts/generate-icons.js && npx exifreader build
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with scripts/generate-icons.js at line 24 and reproduce the postinstall build in a node:26-alpine container without the increased nofile limit. The work is done when the icon generation and subsequent build complete without the EMFILE error; use the reported path and stack trace to verify the failure is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.