Skip to content

Fix SidecarFeaturesDisabledTests regression from sidecar appsec integration - #4164

Open
estringana wants to merge 7 commits into
masterfrom
estringana/fix-appsec-tests
Open

Fix SidecarFeaturesDisabledTests regression from sidecar appsec integration#4164
estringana wants to merge 7 commits into
masterfrom
estringana/fix-appsec-tests

Conversation

@estringana

@estringana estringana commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

After #3725 embedded appsec into the sidecar, SidecarFeaturesDisabledTests > appsec is disabled and sidecar is not launched started failing intermittently.

The test was killing the sidecar with kill -9 and then restarting Apache. The problem: existing Apache workers hold a reconnect callback (registered in ddog_sidecar_connect_php). When the sidecar is killed, the reconnect mechanism immediately spawns a new sidecar subprocess — before Apache restarts. That new subprocess becomes an orphan (its parent workers die during the restart), and pgrep -f datadog-ipc-helper finds it, failing the assertion.

Fix: restart Apache first so the old workers — and their reconnect callbacks — are torn down cleanly. Only then kill any remaining sidecar. Since the new workers start with datadog.appsec.enabled=false, they don't connect to the sidecar and no reconnect will be triggered.

@datadog-official

datadog-official Bot commented Sep 7, 2026

Copy link
Copy Markdown

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 9 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-php | check libxml2 version — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-php | check-big-regressions — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-php | test_extension_ci: [8.3] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

View all 9 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 50.00%
Overall Coverage: 55.03% (-0.02%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d2234fb | Docs | View more details | Give us feedback!

@estringana estringana changed the title Fix appsec tests Fix SidecarFeaturesDisabledTests regression from sidecar appsec integration Sep 7, 2026
@estringana
estringana marked this pull request as ready for review September 7, 2026 15:32
@estringana
estringana requested review from a team as code owners September 7, 2026 15:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T15:38:45.456464Z fa17942 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cataphract cataphract left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be preferable to make the shutdown messages not try to restart sidecar. So, do not retry in that case.

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

Copy link
Copy Markdown

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: fa1794266c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +84 to +85
res = CONTAINER.execInContainer('service', 'apache2', 'restart')
assert res.exitCode == 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wait for old Apache workers before killing the sidecar

When service apache2 restart returns while an old worker is still draining, the subsequent kill can occur while that worker still owns its reconnect callback, allowing it to spawn the same orphaned sidecar before exiting and leaving the final pgrep assertion flaky. In this test container, CrashDetectionTests.groovy:97-100 explicitly captures and waits for old worker PIDs after the same restart command, so equivalent synchronization is needed here before killing the helper.

Useful? React with 👍 / 👎.

@estringana
estringana requested review from a team as code owners September 8, 2026 09:57
@pr-commenter

pr-commenter Bot commented Sep 8, 2026

Copy link
Copy Markdown

Benchmarks [ tracer ]

Benchmark execution time: 2026-09-09 19:28:37

Comparing candidate commit d2234fb in PR branch estringana/fix-appsec-tests with baseline commit 4afbf6f in branch master.

Found 0 performance improvements and 3 performance regressions! Performance is the same for 191 metrics, 0 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:SamplingRuleMatchingBench/benchRegexMatching1

  • 🟥 execution_time [+75.923ns; +162.077ns] or [+5.189%; +11.077%]

scenario:SamplingRuleMatchingBench/benchRegexMatching2

  • 🟥 execution_time [+65.128ns; +123.072ns] or [+4.427%; +8.365%]

scenario:SamplingRuleMatchingBench/benchRegexMatching3

  • 🟥 execution_time [+17.796µs; +17.941µs] or [+1209.884%; +1219.744%]

gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/libdatadog that referenced this pull request Sep 8, 2026
…nect (#2481)

To avoid restarting sidecar during php shutdown.

See also: DataDog/dd-trace-php#4164

Co-authored-by: gustavo.lopes <gustavo.lopes@datadoghq.com>
@estringana
estringana force-pushed the estringana/fix-appsec-tests branch from ec4c1ac to 7c68ae8 Compare September 8, 2026 15:25
@cataphract
cataphract force-pushed the estringana/fix-appsec-tests branch from b3001e8 to 7019bae Compare September 9, 2026 14:40
@cataphract
cataphract requested a review from a team as a code owner September 9, 2026 14:40
@cataphract
cataphract requested review from sameerank and typotter and removed request for a team September 9, 2026 14:40
@cataphract
cataphract requested a review from a team as a code owner September 9, 2026 14:56
@pr-commenter

pr-commenter Bot commented Sep 9, 2026

Copy link
Copy Markdown

Benchmarks [ appsec ]

Benchmark execution time: 2026-09-09 18:34:31

Comparing candidate commit d2234fb in PR branch estringana/fix-appsec-tests with baseline commit 4afbf6f in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants