Repository navigation
fix(bazel): schedule Go links by memory to stop e2e build OOM kills - #57555
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
Conversation
### What does this PR do? Patch rules_go with bazel-contrib/rules_go#4727, which declares a 2048MB `resource_set` for `GoLink` instead of Bazel's 250MB default. ### Motivation `go_e2e_test_binaries` OOM kills resurfaced on `main` (#incident-61714) after #56683 bumped a constant in a package every e2e test depends on, forcing all test binaries to relink instead of hitting the remote cache: ``` ERROR: Job failed (system failure): Error in container build: exit code: 137, reason: 'OOMKilled' ``` https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2108531979 ``` collect2: fatal error: ld terminated with signal 11 [Segmentation fault] ``` https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2108458779 Bazel accounted 250MB per link and thus ran 16 of them at once, one per CPU granted by #56994, whereas a link peaks at up to 2490MB RSS, beyond the 32Gi memory limit #56994 also set. ### Describe how you validated your changes `//pkg/version:version_test` builds with the patch applied and `MODULE.bazel.lock` stays unchanged.
There was a problem hiding this comment.
AI review by Codex (OpenAI) - workflow run
Patch is correct. The patch adds a valid memory resource estimate to Go link actions and registers it in the existing rules_go override. No actionable issues found. Build validation was not run in this read-only environment.
Files inventory check summaryFile checks results against ancestor 62356959: Results for datadog-agent_7.86.0~devel.git.114.8c095b0.pipeline.142411670-1_amd64.deb:No change detected Results for datadog-iot-agent_7.86.0~devel.git.114.8c095b0.pipeline.142411670-1_amd64.deb:No change detected |
Static quality checks✅ Please find below the results from static quality gates 33 successful checks with minimal change (< 2 KiB)
|
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: 1791cb2 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | quality_gate_security_mean_fs_load | memory utilization | +0.74 | [+0.70, +0.77] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_private_action_runner | memory utilization | +0.27 | [+0.14, +0.39] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle | memory utilization | +0.22 | [+0.18, +0.27] | 1 | Logs bounds checks dashboard |
| ➖ | python_openmetrics | % cpu utilization | +0.05 | [-0.62, +0.71] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle_all_features | memory utilization | +0.02 | [-0.05, +0.10] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_idle | memory utilization | -0.12 | [-0.16, -0.08] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_no_fs_load | memory utilization | -0.24 | [-0.32, -0.17] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_logs | % cpu utilization | -0.30 | [-1.17, +0.57] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_metrics_logs | memory utilization | -0.33 | [-0.56, -0.10] | 1 | Logs bounds checks dashboard |
| ➖ | dsd_uds_client_drop_detector_cpu | % cpu utilization | -0.34 | [-0.85, +0.16] | 1 | Logs |
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_memory | memory utilization | -0.74 | [-0.96, -0.52] | 1 | Logs |
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_cpu | % cpu utilization | -0.80 | [-1.03, -0.56] | 1 | Logs |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | python_openmetrics | checks_execution_time | 10/10 | 71.58 ≤ 100 | bounds checks dashboard |
| ✅ | python_openmetrics | cpu_usage | 10/10 | 1330.68 ≤ 1500 | bounds checks dashboard |
| ✅ | python_openmetrics | memory_usage | 10/10 | 4.33GiB ≤ 4.75GiB | bounds checks dashboard |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 4 ≤ 5 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 174.00MiB ≤ 181MiB | bounds checks dashboard |
| ✅ | quality_gate_idle | total_bytes_received | 10/10 | 761.30KiB ≤ 819.20KiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 2 ≤ 5 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 471.96MiB ≤ 542MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 1.13MiB ≤ 1.25MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 18 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 211.26MiB ≤ 228MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_logs | total_bytes_received | 10/10 | 263.22MiB ≤ 292MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 376.79 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 20 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 432.34MiB ≤ 455MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | total_bytes_received | 10/10 | 0.94GiB ≤ 1.04GiB | bounds checks dashboard |
| ✅ | quality_gate_private_action_runner | memory_usage | 10/10 | 73.80MiB ≤ 77MiB | bounds checks dashboard |
| ✅ | quality_gate_security_idle | cpu_usage | 10/10 | 29.52 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_idle | memory_usage | 10/10 | 329.23MiB ≤ 357MiB | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | cpu_usage | 10/10 | 62.08 ≤ 200 | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | memory_usage | 10/10 | 303.90MiB ≤ 337MiB | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | cpu_usage | 10/10 | 23.52 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | memory_usage | 10/10 | 315.16MiB ≤ 348MiB | bounds checks dashboard |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_mean_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
353a00a
into
main
…57555) ### What does this PR do? Patch `rules_go` with bazel-contrib/rules_go#4727, which declares a 2048MB `resource_set` for `GoLink` instead of Bazel's 250MB default. ### Motivation `go_e2e_test_binaries` OOM kills resurfaced on `main` ([#incident-61714](https://dd.enterprise.slack.com/archives/C0C6V8J63B3)) after #56683 bumped a constant in a package every e2e test depends on, forcing all test binaries to relink at once instead of hitting the remote cache, leading to either: - `OOMKilled` ([example](https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2108531979)): ``` ERROR: Job failed (system failure): Error in container build: exit code: 137, reason: 'OOMKilled' ``` - or `Segmentation fault` ([example](https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2108458779)): ``` collect2: fatal error: ld terminated with signal 11 [Segmentation fault] ``` Bazel accounts 250MB per action and thus runs 16 of them at once, one per CPU granted since #56994, whereas a Go link peaks at up to 2490MB RSS, beyond the 32Gi memory limit (shared with Bazel's JVM, among others). ### Describe how you validated your changes `//pkg/version:version_test` builds with the patch applied and `MODULE.bazel.lock` stays unchanged. Co-authored-by: regis.desgroppes <[email protected]> 353a00a
### What does this PR do? Book 6144 MiB for the `GoLink` action of the 9 non-`manual` `dd_agent_go_test` unit test targets whose packages import the e2e framework, through the `go_link` exec group's `resources:memory`. 6144 is the multiple of 1024 closest to their peak link RSS, measured between 5826 MiB (lower bound) and 6241 MiB (upper bound) on Linux. Document the pattern in `bazel/AGENTS.md`. ### Motivation `bazel:test:windows-amd64:go` failed in the merge queue (https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2121988398) with 5 unit test binaries failing to link and `client_test` timing out after 304s instead of passing in seconds: ``` runtime: VirtualAlloc of 1540096 bytes failed with errno=1455 fatal error: out of memory ``` Since #57555, `rules_go` is patched for `GoLink` to declare a flat 2048 MiB `resource_set`, which stopped the `go_e2e_test_binaries` OOM kills on `main` but can't account for outliers. Linking these unit tests peaks at about 30 times the on-disk footprint of their binaries, which embed the e2e framework and weigh 195MiB to 227MiB. On 32GiB `c5.4xlarge` runners, Bazel thus runs enough of these links at once to exhaust the commit limit. ### Describe how you validated your changes `bazel aquery` shows `resources:memory=6144` on the `GoLink` actions of the 9 targets only, not on their compile or test actions. With `--local_resources=memory=13000`, a Bazel profile of their 9 links shows at most 2 running concurrently instead of 6. ### Additional Notes Bazel honors `resources:*` exec properties in local scheduling since 9.2.0 (bazelbuild/bazel#29284), overriding the action's `resource_set`.
…57863) ### What does this PR do? Tell Bazel to account for 6144 MiB (RSS) for the `GoLink` action of the 9 `dd_agent_go_test` unit test targets whose packages import the e2e framework, through a `go_link:enormous` tag that the macro translates into the `go_link` exec group's `resources:memory`. 6144 is the multiple of 1024 closest to their peak link RSS, measured between 5826 MiB (lower bound) and 6241 MiB (upper bound) on Linux. Document the pattern in `bazel/AGENTS.md`. ### Motivation `bazel:test:windows-amd64:go` [failed in the merge queue](https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2121988398) with 5 unit test binaries failing to link and `client_test` timing out after 304s instead of passing in seconds: ``` runtime: VirtualAlloc of 1540096 bytes failed with errno=1455 fatal error: out of memory ``` ... and this was [not an isolated case](https://app.datadoghq.com/logs?query=service%3Agitlab-ci%20%40ci.pipeline.name%3A%22DataDog%2Fdatadog-agent%22%20%22VirtualAlloc%22&agg_m=count&agg_m_source=base&agg_t=count&clustering_pattern_field_path=message&cols=host%2Cservice%2Cci.node.name&index=ci-app-pipeline-logs-gitlab-datadog-agent&messageDisplay=inline&refresh_mode=sliding&storage=hot&stream_sort=time%2Cdesc&viz=stream&from_ts=1790877978397&to_ts=1791482778397). Since #57555, `rules_go` is patched for `GoLink` to declare a flat 2048 MiB `resource_set` (in lieu of only 250), which stopped the `go_e2e_test_binaries` OOM kills on `main` but can't account for outliers. Linking these unit tests indeed peaks at about 30 times the on-disk footprint of their binaries, which embed the e2e framework and weigh 195MiB to 227MiB. On the 32GiB `c5.4xlarge` runners used by Windows jobs, for instance, Bazel thus runs enough of these links at once to exhaust the commit limit. ### Describe how you validated your changes `bazel aquery` shows `resources:memory=6144` on the `GoLink` actions of the 9 targets only, not on their compile or test actions. With `--local_resources=memory=13000`, a Bazel profile of their 9 links shows at most 2 running concurrently instead of 6. ### Additional Notes Bazel honors `resources:*` exec properties in local scheduling since 9.2.0 (bazelbuild/bazel#29284), overriding the action's `resource_set`. Co-authored-by: regis.desgroppes <[email protected]>
What does this PR do?
Patch
rules_gowith bazel-contrib/rules_go#4727, which declares a 2048MBresource_setforGoLinkinstead of Bazel's 250MB default.Motivation
go_e2e_test_binariesOOM kills resurfaced onmain(#incident-61714) after #56683 bumped a constant in a package every e2e test depends on, forcing all test binaries to relink at once instead of hitting the remote cache, leading to either:OOMKilled(example):Segmentation fault(example):Bazel accounts 250MB per action and thus runs 16 of them at once, one per CPU granted since #56994, whereas a Go link peaks at up to 2490MB RSS, beyond the 32Gi memory limit (shared with Bazel's JVM, among others).
Describe how you validated your changes
//pkg/version:version_testbuilds with the patch applied andMODULE.bazel.lockstays unchanged.