Skip to content

fix: raise the executor's open file limit to the hard limit at startup - #2794

Merged
andygrove merged 1 commit into
apache:mainfrom
andygrove:fix-executor-nofile-limit
Nov 10, 2026
Merged

andygrove merged 1 commit into
apache:mainfrom
andygrove:fix-executor-nofile-limit

Conversation

@andygrove

@andygrove andygrove commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Which issue does this PR close?

No single issue. Split out of #2792. Related: #2520 (performance review tracking).

Rationale for this change

A task holds a file per shuffle partition it reads or writes, plus its spill files, so a stage with a few hundred partitions needs thousands of descriptors per executor. With the common soft limit of 1024, TPC-H at 128 or more partitions fails with Too many open files. The JVM raises its soft limit to the hard limit at startup, so Spark executors never see this.

What changes are included in this PR?

A public raise_open_file_limit() raises RLIMIT_NOFILE's soft limit to the hard limit, capped at 2^20 descriptors (10240 on macOS, which rejects a higher soft limit even when the hard limit is unlimited). The cap keeps a container's billion-descriptor hard limit from making every close-all-descriptors loop in a child process crawl. It logs the old and new values and does nothing when the soft limit is already at the target. Unix only.

The ballista-executor binary calls it after logging is set up. start_executor_process does not, because the limit is process-wide and the function is also the entry point for embedders; they call raise_open_file_limit() themselves if they want it. The standalone (in-process) executor is unchanged for the same reason.

The test only checks that the call never lowers the limit: the limit is process-wide, so a stronger check would change it for every other test in the binary.

Are there any user-facing changes?

The executor binary starts with a higher open-file soft limit. raise_open_file_limit is a new public function.

A task holds a file per shuffle partition it reads or writes plus its
spill files, so stages with a few hundred partitions need thousands of
descriptors. With the common 1024 soft limit, TPC-H at 128+ partitions
fails with "Too many open files". The JVM raises its soft limit at
startup, so Spark executors are unaffected; do the same.

@milenkovicm milenkovicm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @andygrove

@andygrove
andygrove added this pull request to the merge queue Nov 10, 2026
@andygrove

Copy link
Copy Markdown
Member Author

Thanks @milenkovicm

Merged via the queue into apache:main with commit a48c232 Nov 10, 2026
24 checks passed
@andygrove
andygrove deleted the fix-executor-nofile-limit branch November 10, 2026 20:34
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