Skip to content

chore(antithesis): non-utf8 bytes in datagrams represent ~1% of generation - #2217

Merged
blt merged 1 commit into
mainfrom
blt/chore_antithesis_is_malformed_based_load_generation
Aug 14, 2026
Merged

chore(antithesis): non-utf8 bytes in datagrams represent ~1% of generation#2217
blt merged 1 commit into
mainfrom
blt/chore_antithesis_is_malformed_based_load_generation

Conversation

@blt

@blt blt commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

ADP and Datadog Agent deal with non-utf8 bytes differently. The way that
intake accepts non-utf8 bytes varies depending on where in the payload they
appear and for which protocol version. Previously I created datagrams that were
too non-utf8 heavy, meaning most payloads could be rejected by intake. This
commit changes the generator to emit non-utf8 bytes into about 1% of datagrams.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

References

@dd-octo-sts dd-octo-sts Bot added the area/test All things testing: unit/integration, correctness, SMP regression, etc. label Jul 27, 2026
@datadog-prod-us1-6

This comment has been minimized.

@pr-commenter

pr-commenter Bot commented Jul 27, 2026

Copy link
Copy Markdown

Binary Size Analysis (Agent Data Plane)

Baseline: 557ae84 · Comparison: 7471989 · diff
Analysis Configuration: stripped binaries · Pass/Fail Threshold: +5%
Sizes: 41.27 MiB (baseline) vs 41.27 MiB (comparison)
Size Change: +256 B (+0.00%)

✅ Binary size difference within threshold

Changes by Module
Module File Size Symbols
_rjem_je_rtree_leaf_elm_lookup_hard -328 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.12068669625894908922 +130 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.10356578599726312015 -130 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.12068669625894908922 +114 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.10356578599726312015 -114 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.12068669625894908922 +109 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.10356578599726312015 -109 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.12068669625894908922 +97 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.10356578599726312015 -97 B 1
tcache_destroy +96 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.12068669625894908922 +95 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.10356578599726312015 -95 B 1
_rjem_je_sdallocx_default +83 B 1
do_rallocx -78 B 1
_rjem_je_arena_ptr_array_flush +72 B 1
buf_writer_free_internal_buf +51 B 1
realloc +51 B 1
[sections] +43 B 2
_rjem_je_free_default +33 B 1
a0ialloc +32 B 1
Detailed Symbol Changes
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  +700% +1.75Mi    _rjem_je_arena_emap_global
  +0.7%    +266  +0.7%    +262    [24 Others]
  [NEW]    +130  [NEW]     +40    anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.12068669625894908922
  [NEW]    +114  [NEW]     +24    anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.12068669625894908922
  [NEW]    +109  [NEW]     +19    anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.12068669625894908922
  [NEW]     +97  [NEW]      +7    anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.12068669625894908922
  +4.4%     +96  +4.4%     +96    tcache_destroy
  [NEW]     +95  [NEW]      +5    anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.12068669625894908922
  +2.2%     +83  +2.3%     +83    _rjem_je_sdallocx_default
  +0.9%     +72  +0.9%     +72    _rjem_je_arena_ptr_array_flush
  +2.6%     +51  +2.7%     +51    buf_writer_free_internal_buf
  +0.9%     +51  +0.9%     +51    realloc
  +0.0%     +43  +0.0%     +43    [section .text]
  -1.7%     -78  -1.7%     -78    do_rallocx
  [DEL]     -95  [DEL]      -5    anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.10356578599726312015
  [DEL]     -97  [DEL]      -7    anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.10356578599726312015
  [DEL]    -109  [DEL]     -19    anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.10356578599726312015
  [DEL]    -114  [DEL]     -24    anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.10356578599726312015
  [DEL]    -130  [DEL]     -40    anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.10356578599726312015
  [ = ]       0 -54.2%    -256    [section .relro_padding]
 -39.0%    -328 -41.9%    -328    _rjem_je_rtree_leaf_elm_lookup_hard
  +0.0%    +256  +5.3% +1.75Mi    TOTAL

@blt blt changed the title chore(antithesis): is_malformed based load generation chore(antithesis): non-utf8 bytes payloads represent 1% of generation Jul 27, 2026
@blt
blt marked this pull request as ready for review July 27, 2026 23:24
@blt
blt requested review from a team as code owners July 27, 2026 23:24

@datadog-prod-us1-6 datadog-prod-us1-6 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.

Datadog Autotest: PASS

More details

The new injection is bounded to one byte per datagram, preserves the existing size and forwarding invariants, and excludes event and service-check lines from metric-name mutation. No diff-only behavioral regression was identified; runtime confirmation was blocked by unavailable Rust dependencies in the sandbox.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 43cf97d · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@pr-commenter

pr-commenter Bot commented Jul 27, 2026

Copy link
Copy Markdown

Regression Detector (Agent Data Plane)

Run ID: 91fade82-98ca-4a0b-a9a0-5f3e89a014b8
Baseline: 71a9d5cf · Comparison: 377fcf0f · diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment (5)

Experiments configured erratic: true are tagged (ignored) and skipped when determining which experiments regressed or improved. Experiments which are detected as erratic at runtime are tagged (erratic) to flag that the run's sample dispersion was high, but their regression / improvement signal still counts.

experiment goal Δ mean % links
quality_gates_rss_dsd_ultraheavy memory ⚪ +0.23 metrics profiles logs
quality_gates_rss_dsd_low memory ⚪ +0.08 metrics profiles logs
quality_gates_rss_idle memory ⚪ -0.06 metrics profiles logs
quality_gates_rss_dsd_heavy memory ⚪ -0.19 metrics profiles logs
quality_gates_rss_dsd_medium memory ⚪ -0.26 metrics profiles logs
Bounds Checks: ✅ Passed (5)
experiment check replicates observed links
quality_gates_rss_dsd_heavy memory_usage 10/10 ✅ 226 MiB ≤ 250 MiB metrics profiles logs
quality_gates_rss_dsd_low memory_usage 10/10 ✅ 51.9 MiB ≤ 60 MiB metrics profiles logs
quality_gates_rss_dsd_medium memory_usage 10/10 ✅ 90.9 MiB ≤ 100 MiB metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 ✅ 381 MiB ≤ 420 MiB metrics profiles logs
quality_gates_rss_idle memory_usage 10/10 ✅ 32.1 MiB ≤ 40 MiB metrics profiles logs
Explanation

A change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression (is_regression: true). Improvements use the matching criteria for the improving direction. Experiments configured erratic: true (tagged (ignored)) are skipped outright; experiments detected as erratic at runtime (tagged (erratic)) still count, since that flag describes sample dispersion rather than directional certainty. The Δ mean % cell is colored accordingly: 🟢 = improvement, 🔴 = regression, ⚪ = neutral. Reduction in CPU or memory is an improvement; reduction in ingress throughput is a regression.

@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: 43cf97d287

ℹ️ 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 test/antithesis/harness/src/payload/dogstatsd/common.rs Outdated
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch from 34de63f to a827899 Compare July 29, 2026 17:15
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 43cf97d to 86e0959 Compare July 29, 2026 17:15
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch from a827899 to e45d94e Compare July 29, 2026 20:37
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 86e0959 to 793eced Compare July 29, 2026 20:37

@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: 793eced78f

ℹ️ 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 test/antithesis/harness/src/payload/dogstatsd.rs Outdated
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch from e45d94e to cb1f9df Compare July 29, 2026 20:50
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch 2 times, most recently from 2a19b2e to 74d04b8 Compare July 29, 2026 21:18
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch from cb1f9df to 639f6b7 Compare July 29, 2026 21:18
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 74d04b8 to fdea3d5 Compare July 29, 2026 22:42
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch 2 times, most recently from 39f3b2a to a8467bf Compare July 29, 2026 22:55
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from fdea3d5 to 52ca146 Compare July 29, 2026 22:55
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch from a8467bf to 75b7b70 Compare July 29, 2026 23:00
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch 2 times, most recently from 7fc724f to 8d1cf98 Compare July 31, 2026 18:26
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch from 966965a to 2c757ed Compare July 31, 2026 18:26

@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: 8d1cf982d9

ℹ️ 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 test/antithesis/harness/src/payload/dogstatsd.rs
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 8d1cf98 to 5f2c894 Compare July 31, 2026 22:51
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch 2 times, most recently from 3906c44 to 085e47a Compare August 3, 2026 18:35
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 5f2c894 to 0f55ac4 Compare August 3, 2026 18:35
tobz
tobz previously approved these changes Aug 3, 2026
Comment thread test/antithesis/harness/src/config.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same deal here as the other PR: we should fix this, so things pass... and I'll look at exclude these crates out-of-band.

@tobz tobz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Woops, did not mean to approve yet. 😅

@tobz
tobz dismissed their stale review August 3, 2026 18:47

misclick

@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 0f55ac4 to 667dd4b Compare August 12, 2026 04:42
@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch 3 times, most recently from 9f4124e to c920eaa Compare August 12, 2026 05:03
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 667dd4b to 377fcf0 Compare August 12, 2026 05:03

@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: 377fcf0f54

ℹ️ 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 +90 to +95
let context = if non_utf8 {
Context::mint_non_utf8_within(kind, rng, budget)
} else {
Context::mint_within(kind, rng, budget)
}
.with_context(|| {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Retry stochastic seed mints before rejecting the pull

When any of these six initial mints exhausts its random probe retries, Context::mint_within or mint_non_utf8_within returns None even though the datagram budget is valid, but .with_context(...) misclassifies that transient exhaustion as a configuration contradiction. The /contexts route converts the error to HTTP 500, and the new Fetched::Refused path then aborts the driver invocation instead of retrying, so ordinary unlucky generation can fail an Antithesis command; retry the complete seed operation or distinguish probe exhaustion from a genuinely unaffordable budget.

Useful? React with 👍 / 👎.

@blt
blt force-pushed the blt/chore_antithesis_bound_contexts_in_runs branch from c920eaa to 604b4cf Compare August 14, 2026 22:20
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 377fcf0 to 8644d54 Compare August 14, 2026 22:20
@blt
blt changed the base branch from blt/chore_antithesis_bound_contexts_in_runs to graphite-base/2217 August 14, 2026 22:38
The essential property we want to determine is whether ADP-on/ADP-off emits
payloads to intake API that the intake API rejects. This is especially of
interest for inputs that we know are ultimately rejected by intake API --
non-utf8 bytes in the wrong spot -- but are _not_ rejected by the SUT. The
old mechanism had a feral/clean 'vibe' which served for a while but was
confusing to debug. Is feral malformed? Is feral well-formed but wild?

Anyway I got tired of it. There's now a predicate which defines whether
a payload is well-formed or not -- that is, accepted by ADP-off Datadog Agent --
independent of whether intake API ultimately accepts the payloads that ingress
inspires. Later I will build a generator that only emits malformed ingress
but that is only hinted at in this work.
@blt
blt force-pushed the graphite-base/2217 branch from 604b4cf to 557ae84 Compare August 14, 2026 22:38
@blt
blt force-pushed the blt/chore_antithesis_is_malformed_based_load_generation branch from 8644d54 to 7471989 Compare August 14, 2026 22:38
@graphite-app
graphite-app Bot changed the base branch from graphite-base/2217 to main August 14, 2026 22:38

@datadog-prod-us1-6 datadog-prod-us1-6 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.

Datadog Autotest: FAIL

A selected corrupt pull prepends the same invalid identity to every datagram, so a 10,000-datagram invocation can poison consecutive backend flushes rather than limiting rejection to roughly 1%. Initial pool seeding can also turn rare generator exhaustion into an immediate command failure.

Open Bits AI session

🤖 Datadog Autotest · Commit 7471989 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

let mut stats = DatagramStats::default();
let mut line = Vec::new();
loop {
if let Some(lead) = pull.lead {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Spread corruption across datagrams instead of whole invocations

Long carrying invocations can recreate the near-total intake rejection rate this PR is intended to prevent, reducing useful differential-test coverage.

Assertion details
  • Input: A pull containing a non-UTF-8 metric-name context with a large configured datagram_count.
  • Expected: Non-UTF-8 datagrams should be distributed so approximately 1% of generated traffic exercises the behavior without contaminating every downstream flush during one long invocation.
  • Actual: Pull::new records one invalid identity and write_datagram prepends it whenever lead is set. Because the driver reuses that pull for every datagram in the invocation, a selected pull corrupts the entire consecutive batch—up to 10,000 datagrams—not a dispersed 1% sample. Strict downstream name decoding can therefore reject every aggregation payload produced during that streak. Fixing this requires choosing corruption per datagram or budgeting it at the downstream-flush level while reusing a stable pooled corrupt identity; the tests that currently require every datagram from a carrying pull to be corrupt must be updated accordingly.

Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

} else {
Context::mint_within(kind, rng, budget)
}
.with_context(|| {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Do not classify stochastic seed exhaustion as invalid configuration

Ordinary random generation can fail an Antithesis command before any SUT behavior is exercised, producing false failures and lost load.

Assertion details
  • Input: The first /contexts request when any clean or non-UTF-8 seed exhausts its bounded random mint attempts despite a valid budget.
  • Expected: A valid datagram budget should survive transient mint exhaustion and eventually seed both halves; only a proven unaffordable budget should become a permanent refusal.
  • Actual: Each of the six initial seed calls returns None both when the byte budget is impossible and when its bounded random probe loop merely exhausts. .with_context(...) converts both cases into the same error; /contexts returns HTTP 500, and the new Fetched::Refused path immediately aborts the driver rather than retrying. The fix must distinguish permanent budget failure from transient probe exhaustion, retry only the latter, and preserve the permanent configuration error path across the mint API, pool, and fetch handling.

Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@blt
blt merged commit d6c6e40 into main Aug 14, 2026
86 of 92 checks passed

blt commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Aug 14, 10:57 PM UTC: @blt merged this pull request with Graphite.

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

Labels

area/test All things testing: unit/integration, correctness, SMP regression, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants