[Backport 7.78.x] [CONS-8194] Fix panic when advanced dispatching is disabled while KSM Core cluster check is enabled#48714
Conversation
… Core cluster check is enabled (#48700) ### What does this PR do? Fixes the following panic when `DD_CLUSTER_CHECKS_ADVANCED_DISPATCHING_ENABLED` is set to `false` while the KSM core check runs as a cluster check. Clone: #48494 ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2443644] goroutine 1722 [running]: github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks.(*ksmShardingManager).isEnabled(...) github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/ksm_sharding.go:43 github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks.(*dispatcher).scheduleKSMCheck(_, {{0x4000856150, 0x15}, {0x4001310150, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0, ...}, ...}) github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/dispatcher_ksm.go:18 +0x24 github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks.(*dispatcher).Schedule(0x4001650a80, {0x4000a26108?, 0x4001a85eb0?, 0xd?}) github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/dispatcher_main.go:176 +0x220 github.com/DataDog/datadog-agent/comp/core/autodiscovery/scheduler.(*Controller).Register(0x40008fb4a0, {0x361ec8c, 0xd}, {0x3cb1650, 0x4001650a80}, 0x1) github.com/DataDog/datadog-agent/comp/core/autodiscovery/scheduler/controller.go:125 +0x388 github.com/DataDog/datadog-agent/comp/core/autodiscovery/autodiscoveryimpl.(*AutoConfig).AddScheduler(0x400150c798?, {0x361ec8c?, 0x40013ab080?}, {0x3cb1650?, 0x4001650a80?}, 0xd0?) github.com/DataDog/datadog-agent/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go:604 +0x2c github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks.(*Handler).runDispatch(0x4001650b00, {0x3cd23a8, 0x40004a2fa0}) github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/handler.go:163 +0x50 created by github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks.(*Handler).Run in goroutine 635 github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/handler.go:137 +0x2fc ``` ### Motivation CONS-8194 ### Describe how you validated your changes Was able to reproduce this with cluster agent versions 7.74.0+ possibly due to this change: a59c26a Wrote tests to ensure that it does not run into nil errors when advanced dispatching is disabled. ### Additional notes With this change, I believe KSM Resource Type sharding will require advanced dispatching to be enabled. Co-authored-by: zhuminyi <minyi.zhu@datadoghq.com> Co-authored-by: mrdoggopat <patrick.liang@datadoghq.com> Co-authored-by: gabe.dossantos <gabe.dossantos@datadoghq.com> (cherry picked from commit 56ac038) ___ Co-authored-by: Gabriel Dos Santos <91925154+gabedos@users.noreply.github.com>
Files inventory check summaryFile checks results against ancestor 9486d535: Results for datadog-agent_7.78.0~rc.5.git.1.c38737b.pipeline.105389979-1_amd64.deb:No change detected |
Static quality checks✅ Please find below the results from static quality gates 31 successful checks with minimal change (< 2 KiB)
On-wire sizes (compressed)
|
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: 9486d53 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | +0.97 | [-2.09, +4.04] | 1 | Logs |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | +0.97 | [-2.09, +4.04] | 1 | Logs |
| ➖ | otlp_ingest_logs | memory utilization | +0.74 | [+0.65, +0.83] | 1 | Logs |
| ➖ | otlp_ingest_metrics | memory utilization | +0.35 | [+0.19, +0.50] | 1 | Logs |
| ➖ | ddot_logs | memory utilization | +0.33 | [+0.27, +0.39] | 1 | Logs |
| ➖ | docker_containers_memory | memory utilization | +0.31 | [+0.24, +0.38] | 1 | Logs |
| ➖ | quality_gate_idle_all_features | memory utilization | +0.11 | [+0.07, +0.15] | 1 | Logs bounds checks dashboard |
| ➖ | uds_dogstatsd_20mb_12k_contexts_20_senders | memory utilization | +0.08 | [+0.02, +0.14] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulativetodelta_exporter | memory utilization | +0.07 | [-0.16, +0.29] | 1 | Logs |
| ➖ | file_to_blackhole_1000ms_latency | egress throughput | +0.05 | [-0.39, +0.48] | 1 | Logs |
| ➖ | ddot_metrics_sum_delta | memory utilization | +0.03 | [-0.13, +0.20] | 1 | Logs |
| ➖ | file_to_blackhole_0ms_latency | egress throughput | +0.03 | [-0.45, +0.51] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api_v3 | ingress throughput | -0.00 | [-0.20, +0.19] | 1 | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.00 | [-0.11, +0.11] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | -0.01 | [-0.20, +0.19] | 1 | Logs |
| ➖ | file_to_blackhole_100ms_latency | egress throughput | -0.02 | [-0.10, +0.05] | 1 | Logs |
| ➖ | quality_gate_idle | memory utilization | -0.03 | [-0.08, +0.02] | 1 | Logs bounds checks dashboard |
| ➖ | file_tree | memory utilization | -0.04 | [-0.10, +0.01] | 1 | Logs |
| ➖ | file_to_blackhole_500ms_latency | egress throughput | -0.06 | [-0.45, +0.33] | 1 | Logs |
| ➖ | ddot_metrics | memory utilization | -0.17 | [-0.34, +0.00] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulative | memory utilization | -0.25 | [-0.39, -0.11] | 1 | Logs |
| ➖ | quality_gate_metrics_logs | memory utilization | -1.00 | [-1.23, -0.76] | 1 | Logs bounds checks dashboard |
| ➖ | tcp_syslog_to_blackhole | ingress throughput | -1.03 | [-1.16, -0.90] | 1 | Logs |
| ➖ | quality_gate_logs | % cpu utilization | -2.05 | [-3.57, -0.53] | 1 | Logs bounds checks dashboard |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | docker_containers_cpu | simple_check_run | 10/10 | 721 ≥ 26 | |
| ✅ | docker_containers_memory | memory_usage | 10/10 | 278.90MiB ≤ 370MiB | |
| ✅ | docker_containers_memory | simple_check_run | 10/10 | 705 ≥ 26 | |
| ✅ | file_to_blackhole_0ms_latency | memory_usage | 10/10 | 0.19GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_0ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_1000ms_latency | memory_usage | 10/10 | 0.23GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_1000ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_100ms_latency | memory_usage | 10/10 | 0.19GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_100ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_500ms_latency | memory_usage | 10/10 | 0.22GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_500ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 3 = 3 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 174.07MiB ≤ 175MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 2 ≤ 3 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 490.65MiB ≤ 550MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 4 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 204.05MiB ≤ 220MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 349.00 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 4 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 407.06MiB ≤ 475MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | 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_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_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 cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
Backport 56ac038 from #48700.
What does this PR do?
Fixes the following panic when
DD_CLUSTER_CHECKS_ADVANCED_DISPATCHING_ENABLEDis set tofalsewhile the KSM core check runs as a cluster check.Clone: #48494
Motivation
CONS-8194
Describe how you validated your changes
Was able to reproduce this with cluster agent versions 7.74.0+ possibly due to this change: a59c26a
Wrote tests to ensure that it does not run into nil errors when advanced dispatching is disabled.
Additional notes
With this change, I believe KSM Resource Type sharding will require advanced dispatching to be enabled.