Fix SidecarFeaturesDisabledTests regression from sidecar appsec integration - #4164
Fix SidecarFeaturesDisabledTests regression from sidecar appsec integration#4164estringana wants to merge 7 commits into
Conversation
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
cataphract
left a comment
There was a problem hiding this comment.
I think it would be preferable to make the shutdown messages not try to restart sidecar. So, do not retry in that case.
There was a problem hiding this comment.
💡 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".
| res = CONTAINER.execInContainer('service', 'apache2', 'restart') | ||
| assert res.exitCode == 0 |
There was a problem hiding this comment.
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 👍 / 👎.
Benchmarks [ tracer ]Benchmark execution time: 2026-09-09 19:28:37 Comparing candidate commit d2234fb in PR branch Found 0 performance improvements and 3 performance regressions! Performance is the same for 191 metrics, 0 unstable metrics.
|
…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>
ec4c1ac to
7c68ae8
Compare
b3001e8 to
7019bae
Compare
Benchmarks [ appsec ]Benchmark execution time: 2026-09-09 18:34:31 Comparing candidate commit d2234fb in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.
|
Summary
After #3725 embedded appsec into the sidecar,
SidecarFeaturesDisabledTests > appsec is disabled and sidecar is not launchedstarted failing intermittently.The test was killing the sidecar with
kill -9and then restarting Apache. The problem: existing Apache workers hold a reconnect callback (registered inddog_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), andpgrep -f datadog-ipc-helperfinds 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.