From 3c936cb69c4193e36e5a22e5d700ce30d97ca226 Mon Sep 17 00:00:00 2001 From: hermes-agent Date: Fri, 17 Apr 2026 14:22:42 +0000 Subject: [PATCH] fix: cap uv concurrency to prevent ENFILE errors during bundling When uv extracts many wheel files in parallel, the builder container can exhaust the system-wide file descriptor limit (os error 23: Too many open files), especially on Docker Desktop/macOS environments. Add UV_CONCURRENT_DOWNLOADERS=4 and UV_CONCURRENT_BUILDS=2 to the builder environment to limit uv's internal parallelism. This prevents the FD exhaustion without meaningfully impacting performance, since most wheels are served from cache on subsequent builds. Fixes intermitent 'CommandExitedWithNonZeroStatus: docker exited with status 1' errors caused by failed wheel extraction. --- src/bundling.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bundling.ts b/src/bundling.ts index de25f66..ce94a07 100644 --- a/src/bundling.ts +++ b/src/bundling.ts @@ -365,6 +365,10 @@ function getBuilderEnvironment( ): Record { return { UV_PYTHON_LAMBDA_NOFILE_LIMIT: BUILDER_NOFILE_LIMIT.split(':')[0], + // Cap uv concurrency to avoid system-wide file descriptor exhaustion + // during parallel extraction (os error 23: ENFILE). + UV_CONCURRENT_DOWNLOADERS: '4', + UV_CONCURRENT_BUILDS: '2', ...environment, }; }