ci: pin build_base_venvs memory to prevent cold-cache OOM#18962
Conversation
build_base_venvs compiles every native extension (Rust _native, Cython, IAST, profiling) at CMAKE_BUILD_PARALLEL_LEVEL=12. When a version's ext_cache is cold -- e.g. a newly added Python version such as 3.15 -- the full 12-way parallel compile peaks well above the ~5Gi the VPA tunes this job down to (observed "MemoryLimit changed from 6Gi to 5012971110"), and the job is OOMKilled (exit 137) deterministically. Pin CPU/memory and disable the VPA, matching the resource requests the native package build jobs (.build_base, "test sdist") already use. This keeps build parallelism intact and only affects cold-cache builds; warm builds barely compile anything.
Codeowners resolved as |
Circular import analysis
|
🎉 All green!🧪 All tests passed 🔄 Datadog retried 8 tests - 8 passed on retry 🚧 3 tests that failed were ignored due to quarantine 🔗 Commit SHA: 88c0f8b | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-07-13 19:23:26 Comparing candidate commit 88c0f8b in PR branch Found 0 performance improvements and 6 performance regressions! Performance is the same for 616 metrics, 10 unstable metrics. scenario:iastaspects-index_aspect
scenario:iastaspects-ljust_aspect
scenario:iastaspects-swapcase_aspect
scenario:iastaspectsospath-ospathbasename_aspect
scenario:span-start
scenario:tracer-small
|
There was a problem hiding this comment.
Pull request overview
This PR updates the GitLab CI build_base_venvs job to avoid cold-cache OOMKills by explicitly pinning Kubernetes CPU/memory requests/limits and disabling VPA tuning, aligning its runtime constraints with other native-build jobs in the pipeline.
Changes:
- Add
KUBERNETES_CPU_REQUEST,KUBERNETES_MEMORY_REQUEST, andKUBERNETES_MEMORY_LIMITtobuild_base_venvs. - Set
DD_DISABLE_VPAto prevent VPA from clamping memory during cold-cache native extension builds. - Document the rationale inline in the job’s variables section.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
## Description `build_base_venvs` is OOMKilled for cold-`ext_cache` Python versions. Currently this happens for `v3.15` only, which is new and has no warm cache. This was found while working on #17849. **Root cause** - It sets **no** `KUBERNETES_MEMORY_*` and does not disable the VPA, so the autoscaler tunes the limit down to ~5GB, based on the cheap **warm-cache** history. - A cold version compiles everything at 12-way parallelism, which exceeds the approximated limit. ### Changes Pin CPU/memory and disable the VPA on `build_base_venvs`, matching what `.build_base`, `test sdist` already use for the same build targets: ```yaml KUBERNETES_CPU_REQUEST: '6' KUBERNETES_MEMORY_REQUEST: '10Gi' KUBERNETES_MEMORY_LIMIT: '10Gi' DD_DISABLE_VPA: 'true' ``` ## Test plan * [Next PR](#17849) passes [dd-gitlab/build_base_venvs: [3.15]](https://gitlab.ddbuild.io/datadog/apm-reliability/dd-trace-py/builds/1846141002) <img width="494" height="472" alt="Screenshot 2026-07-09 at 4 25 46 PM" src="https://github.com/user-attachments/assets/c622de21-a232-4f23-a085-728ad4461d25" /> ## Additional Notes * Warm builds are unaffected. * The failing job logs also show the GitLab **runner S3 cache returning 403 AccessDenied**, so `ext_cache` restore fails on every run and forces cold compiles every time. That's a runner/`ddbuild` platform-side credential issue. Fixing this separately would restores warm-build speed. Co-authored-by: vlad.scherbich <vlad.scherbich@datadoghq.com>
Description
build_base_venvsis OOMKilled for cold-ext_cachePython versions. Currently this happens forv3.15only, which is new and has no warm cache. This was found while working on #17849.Root cause
KUBERNETES_MEMORY_*and does not disable the VPA, so the autoscaler tunes the limit down to ~5GB, based on the cheap warm-cache history.Changes
Pin CPU/memory and disable the VPA on
build_base_venvs, matching what.build_base,test sdistalready use for the same build targets:Test plan
Additional Notes
ext_cacherestore fails on every run and forces cold compiles every time. That's a runner/ddbuildplatform-side credential issue. Fixing this separately would restores warm-build speed.