datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

usm: Re-enable Kafka raw split tests with workaround in proxy

Open vitkyrka opened this issue 1 year ago • 2 comments

What does this PR do?

Occasional errors have been seen in the Kafka TLS raw test (for example, TestKafkaProtocolParsing/CO-RE/TestKafkaFetchRaw/with_TLS/api12/split/many_partitions), which have been tracked down to being due to the bpf_probe_read_user() helper returning -EFAULT. So a minor fault is seen on read even though the page has just been written to, for whatever reason (possibly related to page migration or transparent hugepage support).

A possible real fix in USM would be to use sleeping uprobes and bpf_copy_from_user(), but that is only available on recent kernels.

To work around this issue, reuse buffers in the transparent proxy instead of reallocating new ones every time. Reusing the same buffer appears to leads the kernel to be less likely to mess with our pages.

With this work around in place, the PR re-enables the test.

Motivation

https://datadoghq.atlassian.net/browse/USMON-1025

Additional Notes

No failures seen in CI with three branch (in order to run more times) with this patch and the tests modified to run 10 times:

https://app.datadoghq.com/ci/test-runs?query=test_level%3Atest%20%40git.repository.id%3Agitlab.ddbuild.io%2FDataDog%2Fdatadog-agent%20%40git.branch%3Avincent.whitchurch%2Fflaky-bufferfix%2A%20%40test.name%3A%2AKafka%2A&agg_m=count&agg_m_source=base&agg_t=count&citest_explorer_sort=timestamp%2Cdesc&cols=%40test.status%2Ctimestamp%2C%40test.suite%2C%40test.name%3A581%2C%40duration%3A150%2C%40test.service%3A104%2C%40git.branch&currentTab=overview&eventStack=&fromUser=false&index=citest&start=1719469768968&end=1720074568968&paused=false

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

vitkyrka avatar Jul 04 '24 06:07 vitkyrka

[Fast Unit Tests Report]

On pipeline 38384133 (CI Visibility). The following jobs did not run any unit tests:

Jobs:
  • tests_deb-arm64-py3
  • tests_deb-x64-py3
  • tests_flavor_dogstatsd_deb-x64
  • tests_flavor_heroku_deb-x64
  • tests_flavor_iot_deb-x64
  • tests_rpm-arm64-py3
  • tests_rpm-x64-py3
  • tests_windows-x64

If you modified Go files and expected unit tests to run in these jobs, please double check the job logs. If you think tests should have been executed reach out to #agent-devx-help

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv create-vm --pipeline-id=38384133 --os-family=ubuntu

Note: This applies to commit 00b013c2

pr-commenter[bot] avatar Jul 04 '24 06:07 pr-commenter[bot]

Regression Detector

Regression Detector Results

Run ID: d50a2fdc-8389-4e4d-be27-29a07afcf1f6 Metrics dashboard Target profiles

Baseline: ac7a4e048c77cf88e815d3d98eeb8aa197c919aa Comparison: 00b013c2632c3cc9b0ae1ed21c7eedf8bb4f6619

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

No significant changes in experiment optimization goals

Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
otel_to_otel_logs ingress throughput +1.24 [+0.42, +2.05] Logs
file_tree memory utilization +1.06 [+0.94, +1.18] Logs
uds_dogstatsd_to_api_cpu % cpu utilization +0.35 [-0.54, +1.25] Logs
idle memory utilization +0.26 [+0.21, +0.31] Logs
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.01, +0.01] Logs
uds_dogstatsd_to_api ingress throughput -0.00 [-0.00, +0.00] Logs
tcp_syslog_to_blackhole ingress throughput -0.70 [-13.16, +11.75] Logs
basic_py_check % cpu utilization -1.14 [-3.74, +1.45] Logs
pycheck_1000_100byte_tags % cpu utilization -2.18 [-6.89, +2.53] Logs

Explanation

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

pr-commenter[bot] avatar Jul 04 '24 07:07 pr-commenter[bot]

/merge

vitkyrka avatar Jul 04 '24 16:07 vitkyrka

:steam_locomotive: MergeQueue: pull request added to the queue

The median merge time in main is 25m.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Jul 04 '24 16:07 dd-devflow[bot]