From 4a1a031ebfcc0570bba3622716d3930caf14ede8 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 28 Jul 2026 09:02:50 +0000 Subject: [PATCH] fix(cwl-demangle): increase timeout and chunk size for large Swift binaries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes [LAUNCHPAD-6G](https://sentry.sentry.io/issues/7193300364/) Large Swift binaries with 200,000+ symbols cause cwl-demangle subprocess to exceed the 10-second timeout when processing individual chunks in parallel. Four parallel ThreadPoolExecutor threads each launching a cwl-demangle subprocess simultaneously causes CPU/memory contention. - Increase DEFAULT_CHUNK_SIZE from 500 to 5000, reducing the number of subprocess launches by 10x (e.g., 200k symbols: 400 chunks → 40) - Increase DEFAULT_DEMANGLE_TIMEOUT from 10s to 120s, giving each subprocess adequate time even under contention with parallel workers Both values remain configurable via LAUNCHPAD_DEMANGLE_CHUNK_SIZE and LAUNCHPAD_DEMANGLE_TIMEOUT environment variables. --- src/launchpad/utils/apple/cwl_demangle.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/launchpad/utils/apple/cwl_demangle.py b/src/launchpad/utils/apple/cwl_demangle.py index ddebe786..329f9d60 100644 --- a/src/launchpad/utils/apple/cwl_demangle.py +++ b/src/launchpad/utils/apple/cwl_demangle.py @@ -15,10 +15,13 @@ logger = get_logger(__name__) # Default timeout for cwl-demangle subprocess (in seconds) -DEFAULT_DEMANGLE_TIMEOUT = int(os.environ.get("LAUNCHPAD_DEMANGLE_TIMEOUT", "10")) +# Large binaries (200k+ symbols) can have many chunks running in parallel, +# and CPU contention between parallel cwl-demangle processes requires generous timeouts. +DEFAULT_DEMANGLE_TIMEOUT = int(os.environ.get("LAUNCHPAD_DEMANGLE_TIMEOUT", "120")) # Default chunk size for batching symbols -DEFAULT_CHUNK_SIZE = int(os.environ.get("LAUNCHPAD_DEMANGLE_CHUNK_SIZE", "500")) +# Larger chunks reduce subprocess overhead and CPU contention from parallel workers. +DEFAULT_CHUNK_SIZE = int(os.environ.get("LAUNCHPAD_DEMANGLE_CHUNK_SIZE", "5000")) @dataclass