chalice package hangs indefinitely in AWS CodeBuild; identical internal dependency-download call completes in seconds locally
Environment:
- chalice 1.33.0
- Python 3.11.15
- CI: AWS CodeBuild, aws/codebuild/standard:7.0 (also reproduced after bumping ComputeType from BUILD_GENERAL1_SMALL to BUILD_GENERAL1_MEDIUM — no change)
What's happening:
chalice package --stage={stage} {dir} hangs with zero log output for the entire CodeBuild build timeout (60 minutes) and then fails, consistently, across many separate builds/commits over several days. Locally, the same command completes normally.
Diagnosis so far:
- Ruled out compute starvation: doubling the CodeBuild compute tier had no effect.
- Ruled out dependency-resolution complexity: our requirements.txt had a couple of unpinned packages whose newest releases conflicted with other pins, causing pip's resolver to backtrack. We pinned them; a cold, no-cache pip install --dry-run -r requirements.txt now resolves in 17s. The CodeBuixact same point regardless.
- Isolated the hang to immediately after chalice packages/imports the app (right after the pydantic "populate_by_name" UserWarning), before any further chalice output.
- Reproduced chalice's own internal dependency-download call directly and in isolation: from chalice.deploy.packager import SubprocessPip, pip = SubprocessPip() runner = PipRunner(pip) runner.download_all_dependencies('requirements.txt', tempdir) This completed in 5.6 seconds locally, downloadinsing the exact same requirements.txt that hangs foran hour in CodeBuild.
Root cause candidate / ask:
chalice.deploy.packager.SubprocessPip.main() spawns..., stdout=PIPE, stderr=PIPE) and blocks onp.communicate() — none of pip's own output is streamed to the parent process (or to CI logs) until the subprocess exits completely. Whatever is actually stalling in our Cofully-buffered design makes it impossible to get anyreal-time diagnostic signal out of chalice package when it hangs — we can't tell if it's stuck on DNS, a slow/blocked PyPI connection, or something else.
Feature request: an option (e.g. behind --debug or m the underlying pip subprocess's stdout/stderr inreal time, and/or a configurable timeout on chalice's internal pip subprocess calls, so a stall like this doesn't silently consume an entire CI job with no diagnostic trail.
Additional context: a plain shell pip install -r realice's subprocess wrapper) run earlier in the sameCodeBuild job completes in under 2 minutes without issue — only the invocation inside chalice package's dependency builder is affected.
Source: aws/chalice