Skip to content

Prevent request_exec being issued between requests#3939

Open
cataphract wants to merge 9 commits into
masterfrom
glopes/request-exec-outside-req
Open

Prevent request_exec being issued between requests#3939
cataphract wants to merge 9 commits into
masterfrom
glopes/request-exec-outside-req

Conversation

@cataphract

Copy link
Copy Markdown
Contributor

Description

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@cataphract cataphract requested a review from a team as a code owner May 28, 2026 21:02

@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: 401529728b

ℹ️ 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 thread appsec/src/extension/request_lifecycle.c Outdated
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented May 28, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 10 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-php | ASAN Opcache tests: [8.5]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | ASAN test_c with multiple observers: [8.3]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | ASAN test_c with multiple observers: [8.5]   View in Datadog   GitLab

View all 10 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 42.11%
Overall Coverage: 54.09% (-0.04%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ff281ae | Docs | Datadog PR Page | Give us feedback!

@pr-commenter

pr-commenter Bot commented May 28, 2026

Copy link
Copy Markdown

Benchmarks [ appsec ]

Benchmark execution time: 2026-06-09 14:07:07

Comparing candidate commit ff281ae in PR branch glopes/request-exec-outside-req with baseline commit 0f53344 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 ----------------------------------'

@cataphract cataphract force-pushed the glopes/request-exec-outside-req branch from 4015297 to 4828351 Compare May 28, 2026 22:02
@cataphract cataphract force-pushed the glopes/request-exec-outside-req branch from 4828351 to 4d74189 Compare May 29, 2026 09:41
cataphract and others added 8 commits May 29, 2026 18:16
After a successful command exchange (e.g. request_init), the helper
has entered its inner request loop and is waiting for the matching
request_shutdown. If _imsg_destroy() reports a msgpack framing error
at that point, the code was returning dd_error.

dd_error does not trigger dd_helper_close_conn(), so the connection
stays open while the helper is blocked in the inner loop. On the next
request the extension sends request_init into the inner loop, which
the Rust helper treats as an unexpected command and aborts.

Return dd_network instead, which causes the caller to close and
abandon the connection. This keeps helper and extension state in sync
even in the presence of malformed trailers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Link extension against pthreads (Threads::Threads) to resolve
  undefined symbol: pthread_once on some platforms
- Fix CMake deprecation warning: BYPRODUCT -> BYPRODUCTS
- Add DD_APPSEC_ENABLED=1 env to user_tracking set_user phpt tests
- Update http_client_ip_generation_01 response format
- Update rinit_fail_malformed_resp expected output: malformed responses
  now return dd_network, closing the connection (failed_count=1)
- PG(last_error_message) is char* in all PHP 7.x; became zend_string*
  only in PHP 8.0. Fix the version guard from < 70100 to < 80000.
- zend_set_memory_limit() returns void in PHP 8.0 (changed back to
  bool in PHP 8.1). Guard the return-value check accordingly.
- Expand single-line function bodies to satisfy clang-format.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CI uses clang-format-20 which does not allow single-line function bodies
even when AllowShortBlocksOnASingleLine is true. Expand three offending
functions to multi-line form.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
appsec: fix bailouts during rshutdown
@cataphract

Copy link
Copy Markdown
Contributor Author

Note to reviewers: review only the 1st three commits. Another PR was merged here because it depended on test facilities introduced by this one. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

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

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.

1 participant