Skip to content

[CWS] capture panics on Windows#47618

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomainfrom
safchain/collect-windows-panic
Mar 18, 2026
Merged

[CWS] capture panics on Windows#47618
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomainfrom
safchain/collect-windows-panic

Conversation

@safchain
Copy link
Contributor

@safchain safchain commented Mar 10, 2026

What does this PR do?

On Windows, panic stack traces were not reported in the logs. This change captures and forwards the stack trace when a panic occurs.

Motivation

Describe how you validated your changes

Additional Notes

@safchain safchain added this to the Triage milestone Mar 10, 2026
@safchain safchain added changelog/no-changelog No changelog entry needed team/agent-security category/bugfix qa/done QA done before merge and regressions are covered by tests labels Mar 10, 2026
@github-actions github-actions bot added component/system-probe short review PR is simple enough to be reviewed quickly labels Mar 10, 2026
@dd-octo-sts dd-octo-sts bot added the internal Identify a non-fork PR label Mar 10, 2026
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Mar 10, 2026

Files inventory check summary

File checks results against ancestor d4c34bbf:

Results for datadog-agent_7.78.0~devel.git.679.529c788.pipeline.103267402-1_amd64.deb:

No change detected

@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Mar 10, 2026

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor d4c34bb
📊 Static Quality Gates Dashboard
🔗 SQG Job

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 +4.0 KiB (0.00% increase) 748.899 → 748.903 → 750.720
agent_deb_amd64_fips +4.0 KiB (0.00% increase) 707.261 → 707.265 → 711.230
agent_msi +2.5 KiB (0.00% increase) 602.490 → 602.492 → 1062.520
agent_rpm_amd64 +4.0 KiB (0.00% increase) 748.883 → 748.887 → 750.690
agent_rpm_amd64_fips +4.0 KiB (0.00% increase) 707.244 → 707.248 → 711.210
agent_rpm_arm64 +4.0 KiB (0.00% increase) 727.394 → 727.398 → 732.890
agent_suse_amd64 +4.0 KiB (0.00% increase) 748.883 → 748.887 → 750.690
agent_suse_amd64_fips +4.0 KiB (0.00% increase) 707.244 → 707.248 → 711.210
agent_suse_arm64 +4.0 KiB (0.00% increase) 727.394 → 727.398 → 732.890
docker_agent_amd64 +4.0 KiB (0.00% increase) 809.230 → 809.234 → 813.040
docker_agent_arm64 +4.0 KiB (0.00% increase) 812.543 → 812.547 → 819.570
docker_agent_jmx_amd64 +3.99 KiB (0.00% increase) 1000.145 → 1000.149 → 1003.920
docker_agent_jmx_arm64 +4.0 KiB (0.00% increase) 992.237 → 992.241 → 999.170
18 successful checks with minimal change (< 2 KiB)
Quality gate Current Size
agent_heroku_amd64 312.820 MiB
agent_rpm_arm64_fips 688.706 MiB
agent_suse_arm64_fips 688.706 MiB
docker_cluster_agent_amd64 203.680 MiB
docker_cluster_agent_arm64 218.167 MiB
docker_cws_instrumentation_amd64 7.142 MiB
docker_cws_instrumentation_arm64 6.689 MiB
docker_dogstatsd_amd64 39.199 MiB
docker_dogstatsd_arm64 37.445 MiB
dogstatsd_deb_amd64 29.843 MiB
dogstatsd_deb_arm64 27.995 MiB
dogstatsd_rpm_amd64 29.843 MiB
dogstatsd_suse_amd64 29.843 MiB
iot_agent_deb_amd64 43.065 MiB
iot_agent_deb_arm64 40.124 MiB
iot_agent_deb_armhf 40.860 MiB
iot_agent_rpm_amd64 43.066 MiB
iot_agent_suse_amd64 43.066 MiB
On-wire sizes (compressed)
Quality gate Change Size (prev → curr → max)
agent_deb_amd64 +26.66 KiB (0.01% increase) 174.215 → 174.241 → 177.700
agent_deb_amd64_fips +10.16 KiB (0.01% increase) 165.162 → 165.172 → 172.230
agent_heroku_amd64 -7.75 KiB (0.01% reduction) 74.902 → 74.894 → 79.970
agent_msi -8.0 KiB (0.01% reduction) 137.707 → 137.699 → 146.220
agent_rpm_amd64 +34.97 KiB (0.02% increase) 177.100 → 177.134 → 180.780
agent_rpm_amd64_fips neutral 167.170 MiB → 173.370
agent_rpm_arm64 -19.86 KiB (0.01% reduction) 159.669 → 159.649 → 161.610
agent_rpm_arm64_fips +21.74 KiB (0.01% increase) 151.255 → 151.276 → 155.910
agent_suse_amd64 +34.97 KiB (0.02% increase) 177.100 → 177.134 → 180.780
agent_suse_amd64_fips neutral 167.170 MiB → 173.370
agent_suse_arm64 -19.86 KiB (0.01% reduction) 159.669 → 159.649 → 161.610
agent_suse_arm64_fips +21.74 KiB (0.01% increase) 151.255 → 151.276 → 155.910
docker_agent_amd64 neutral 267.193 MiB → 271.240
docker_agent_arm64 -10.75 KiB (0.00% reduction) 254.485 → 254.474 → 259.800
docker_agent_jmx_amd64 -3.14 KiB (0.00% reduction) 335.840 → 335.837 → 339.870
docker_agent_jmx_arm64 +5.28 KiB (0.00% increase) 319.124 → 319.129 → 324.390
docker_cluster_agent_amd64 neutral 71.289 MiB → 72.920
docker_cluster_agent_arm64 neutral 66.927 MiB → 68.220
docker_cws_instrumentation_amd64 neutral 2.999 MiB → 3.330
docker_cws_instrumentation_arm64 neutral 2.729 MiB → 3.090
docker_dogstatsd_amd64 neutral 15.151 MiB → 15.820
docker_dogstatsd_arm64 neutral 14.479 MiB → 14.830
dogstatsd_deb_amd64 neutral 7.883 MiB → 8.790
dogstatsd_deb_arm64 neutral 6.770 MiB → 7.710
dogstatsd_rpm_amd64 neutral 7.894 MiB → 8.800
dogstatsd_suse_amd64 neutral 7.894 MiB → 8.800
iot_agent_deb_amd64 +3.17 KiB (0.03% increase) 11.349 → 11.352 → 12.040
iot_agent_deb_arm64 neutral 9.667 MiB → 10.450
iot_agent_deb_armhf neutral 9.894 MiB → 10.620
iot_agent_rpm_amd64 neutral 11.369 MiB → 12.060
iot_agent_suse_amd64 neutral 11.369 MiB → 12.060

@cit-pr-commenter-54b7da
Copy link

cit-pr-commenter-54b7da bot commented Mar 10, 2026

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 92c8a669-f757-41a2-8a1f-d8eed28386c8

Baseline: 2d29ddd
Comparison: ffec0a4
Diff

Optimization Goals: ✅ No significant changes detected

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI trials links
docker_containers_cpu % cpu utilization -1.80 [-4.83, +1.24] 1 Logs

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_logs % cpu utilization +2.11 [+0.54, +3.68] 1 Logs bounds checks dashboard
quality_gate_metrics_logs memory utilization +1.37 [+1.12, +1.61] 1 Logs bounds checks dashboard
ddot_metrics_sum_cumulativetodelta_exporter memory utilization +0.67 [+0.45, +0.90] 1 Logs
ddot_metrics_sum_delta memory utilization +0.32 [+0.15, +0.50] 1 Logs
ddot_logs memory utilization +0.31 [+0.25, +0.37] 1 Logs
docker_containers_memory memory utilization +0.16 [+0.09, +0.24] 1 Logs
uds_dogstatsd_20mb_12k_contexts_20_senders memory utilization +0.06 [+0.00, +0.12] 1 Logs
file_to_blackhole_500ms_latency egress throughput +0.06 [-0.33, +0.44] 1 Logs
file_to_blackhole_100ms_latency egress throughput +0.04 [-0.04, +0.12] 1 Logs
otlp_ingest_logs memory utilization +0.02 [-0.07, +0.12] 1 Logs
file_tree memory utilization +0.01 [-0.04, +0.07] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput +0.01 [-0.10, +0.12] 1 Logs
uds_dogstatsd_to_api_v3 ingress throughput +0.01 [-0.18, +0.20] 1 Logs
file_to_blackhole_0ms_latency egress throughput +0.00 [-0.45, +0.45] 1 Logs
uds_dogstatsd_to_api ingress throughput -0.01 [-0.21, +0.19] 1 Logs
file_to_blackhole_1000ms_latency egress throughput -0.05 [-0.48, +0.38] 1 Logs
quality_gate_idle_all_features memory utilization -0.18 [-0.22, -0.15] 1 Logs bounds checks dashboard
tcp_syslog_to_blackhole ingress throughput -0.22 [-0.36, -0.08] 1 Logs
ddot_metrics_sum_cumulative memory utilization -0.25 [-0.39, -0.11] 1 Logs
quality_gate_idle memory utilization -0.29 [-0.34, -0.24] 1 Logs bounds checks dashboard
ddot_metrics memory utilization -0.35 [-0.54, -0.17] 1 Logs
otlp_ingest_metrics memory utilization -0.47 [-0.63, -0.31] 1 Logs
docker_containers_cpu % cpu utilization -1.80 [-4.83, +1.24] 1 Logs

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed observed_value links
docker_containers_cpu simple_check_run 10/10 732 ≥ 26
docker_containers_memory memory_usage 10/10 273.61MiB ≤ 370MiB
docker_containers_memory simple_check_run 10/10 714 ≥ 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.20GiB ≤ 1.20GiB
file_to_blackhole_100ms_latency missed_bytes 10/10 0B = 0B
file_to_blackhole_500ms_latency memory_usage 10/10 0.21GiB ≤ 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 172.98MiB ≤ 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 486.42MiB ≤ 550MiB bounds checks dashboard
quality_gate_logs intake_connections 10/10 4 ≤ 6 bounds checks dashboard
quality_gate_logs memory_usage 10/10 201.89MiB ≤ 220MiB bounds checks dashboard
quality_gate_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 344.89 ≤ 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 415.05MiB ≤ 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:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. 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.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_metrics_logs, bounds check memory_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 missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check cpu_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 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_all_features, 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.

@safchain safchain force-pushed the safchain/collect-windows-panic branch from 5c8d020 to 1623959 Compare March 18, 2026 13:42
On Windows, panic stack traces were not reported in the logs. This
change captures and forwards the stack trace when a panic occurs.
@safchain safchain force-pushed the safchain/collect-windows-panic branch from 1623959 to 529c788 Compare March 18, 2026 13:44
@safchain safchain changed the title [CWS][DRAF] capture panics on Windows [CWS] capture panics on Windows Mar 18, 2026
@safchain safchain marked this pull request as ready for review March 18, 2026 13:45
@safchain safchain requested a review from a team as a code owner March 18, 2026 13:45
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 529c788755

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +193 to +195
time.Sleep(20 * time.Second)

os.Exit(2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope this panic recovery to Windows builds

pkg/security/rules/engine.go is shared code with no Windows build tag, and pkg/security/module/cws.go wires NewRuleEngine into the Linux CWS/system-probe path. That means these new recover() blocks also change Linux behavior: a panic in either policy-reload watcher now leaves the process alive for 20 seconds before os.Exit(2), widening the restart gap and changing crash handling outside the Windows-only scope of this PR.

Useful? React with 👍 / 👎.

Comment on lines +928 to +930
time.Sleep(20 * time.Second)

os.Exit(2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exit immediately after a fatal Windows probe panic

When the event-processing goroutine panics, this defer stops draining p.onStart/p.onStop and then sleeps for 20 seconds before exiting. pkg/windowsdriver/procmon/procmon.go sends process notifications on the unbuffered onStart/onStop channels, so the procmon reader blocks as soon as the sleep starts and the service stays up but blind until os.Exit(2) finally runs.

Useful? React with 👍 / 👎.

@github-actions github-actions bot added medium review PR review might take time and removed short review PR is simple enough to be reviewed quickly labels Mar 18, 2026
@safchain
Copy link
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link

gh-worker-devflow-routing-ef8351 bot commented Mar 18, 2026

View all feedbacks in Devflow UI.

2026-03-18 15:03:46 UTC ℹ️ Start processing command /merge


2026-03-18 15:03:51 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-03-18 15:38:34 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit ffec0a4 into main Mar 18, 2026
403 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot deleted the safchain/collect-windows-panic branch March 18, 2026 15:38
@github-actions github-actions bot modified the milestones: Triage, 7.78.0 Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category/bugfix changelog/no-changelog No changelog entry needed component/system-probe internal Identify a non-fork PR medium review PR review might take time qa/done QA done before merge and regressions are covered by tests team/agent-security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants