src: raise the maximum open files limit on Windows#63643
Open
medns wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR increases the Windows CRT stream I/O limit during platform initialization (unless kNoAdjustResourceLimits is set) to reduce “too many open files” (EMFILE) failures in file-heavy workloads.
Changes:
- Add Windows-specific initialization that calls
_setmaxstdioto raise the CRT max open streams limit (up to 8192), with a fallback loop.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c42204d to
5c81dd3
Compare
On Windows, libuv uses the CRT's _open_osfhandle when opening files. This is constrained by the CRT's maxstdio limit, which defaults to 512, often causing "EMFILE: too many open files" errors for heavy workloads. This commit raises this limit on Windows up to the CRT maximum (8192) by invoking _setmaxstdio during PlatformInit, mirroring the POSIX behavior. Fixes: nodejs#44832 Signed-off-by: 郑苏波 (Super Zheng) <superzheng@tencent.com>
Contributor
|
Can we add a test? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63643 +/- ##
==========================================
+ Coverage 90.28% 90.29% +0.01%
==========================================
Files 730 730
Lines 234802 234802
Branches 43953 43953
==========================================
+ Hits 211991 212023 +32
+ Misses 14530 14498 -32
Partials 8281 8281
🚀 New features to boost your workflow:
|
addaleax
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, libuv uses the CRT's
_open_osfhandlewhen opening files. This is constrained by the CRT'smaxstdiolimit, which defaults to 512, often causing "EMFILE: too many open files" errors for heavy workloads (such as modular building via webpack).This PR raises this limit on Windows up to the CRT maximum (8192) by invoking
_setmaxstdioduringPlatformInit, mirroring the behavior on POSIX platforms.Fixes: #44832