-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
Raise the maximum open files limit on Windows #44832
Copy link
Copy link
Closed as not planned
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.stalewindowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.stalewindowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Type
Fields
Give feedbackNo fields configured for issues without a type.
What is the problem this feature will solve?
The maximum open files limit is increased to maximum on POSIX platforms here
node/src/node.cc
Line 528 in 2a4452a
However, similar functionality is missing for Windows which causes issues with error "EMFILE: too many open files", specially when using webpack.
What is the feature you are proposing to solve the problem?
Use the Windows CRT API to increase the limit. The function is called
_setmaxstdio- https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio?view=msvc-170Different versions of Windows support different limits, the default is 512 files with maximum possible number of 8192. My suggestion would be to use loop for probing the maximum possible value, similar to what is currently done for POSIX. I.e. something like that:
What alternatives have you considered?
Unfortunately, it seems there are no alternatives which can raise the limit for process on OS level (like
ulimiton some *nix OSes). The process itself have to request it.