Skip to content

Retain incomplete allocation traces and validate owner summaries - #433

Closed
thomhurst wants to merge 2 commits into
mainfrom
issue-349-worker-profiles
Closed

thomhurst wants to merge 2 commits into
mainfrom
issue-349-worker-profiles

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Four of the 24 native measured profiles from successful run 42761362951 contain an allocation sample without a stack. The reader previously returned success, so the launcher deleted their raw traces. Fail extraction after emitting its records when measured stacks are missing, so the existing failure path retains the trace/index and continues the other launches. Add validated per-thread and complete-type/stack summaries to inspect the remaining allocation owners without treating boundary-emitter threads as workload roles.

Refs #349, now closed as not planned because historical allocation-owner attribution could not be established. This PR independently corrects a demonstrated measurement/retention defect; it does not recover the deleted historical traces or complete the original attribution criterion. No production fix, threshold relaxation, changed-input classification change or performance trade-off.

Reuse: existing TraceEvent allocation stacks and native ThreadID, measurement markers, AllocationGroups, verified frozen-image ABBA launcher, and its existing failed-extraction retention path. No broker feature duplicated. Production per-message cost: unchanged, 0 B and no additional operations. No benchmark required for offline diagnostic tools.

Validation: reader Release build; focused TUnit 4/4; 23 existing Python launcher/verifier tests and two summary tests (13 invalid-profile cases plus aggregate/thread preservation); actionlint; npm ci and production docs build; diff check. Reviewed final diff for reuse, correctness and efficiency. Broker/library integration suites were not run for diagnostic-only tooling.

All 24 native extracted profiles were inspected: 20 complete summaries produced, four rejected for missing stacks. The incomplete profiles are original-input async A1, original-input BDN-waiter B1/B2, and newer-input async B1. Each is missing one sample stack. Complete launches have 1745–1849 measured samples across 7–10 allocating threads. DI scope-cache arrays and BCL blocked channel reads recur in both images. These sampled profiles do not identify the exact historical excess; do not subtract their weights from exact controls. The historical raw traces were already deleted by the old reader; this PR cannot recover them and does not claim otherwise. No workflow rerun or new experiment was requested.

Independent native archive: /Users/tom/git/Relayer-evidence/issue-349/native-thread-42761362951/; original executable manifests verified, all 2160 payload lengths/SHA-256 reverified; archive-inventory.json SHA-256 f490f056e31379ce51ce52957170bf4436b1dc647fd20e2fc34e480be768c4cb. Includes extracted profiles, complete summaries and explicit rejected-profile analysis. Hosted artifact 13738301074 has 90-day retention.

Source, loaded reader binaries, focused test report and validation logs: /Users/tom/git/Relayer-evidence/issue-349/thread-summary/f3ecee0115cf20a3de213446458c047ee2582edd/; 38 payloads reverified; inventory.json SHA-256 b0092a5f3577e35aa4fa485f1da7d76cd50cb15e36ddb33e094446d86fa97073.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T06:09:15.828478Z 34d7c8b Manual request
ℹ️ 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.

@github-actions

Copy link
Copy Markdown

Review

Reviewed the head against AGENTS.md. This is offline diagnostic tooling, so the per-message path is untouched and no benchmark is needed.

  • Reader fix: Program.cs prints every record and then calls VerifyComplete(samplesWithoutStacks), so a nonzero exit still leaves the extracted JSONL in place. In frozen_concurrent_control.py, the CalledProcessError path sets failed and skips trace.unlink(), so the raw trace and index are kept and the other launches continue. This matches the PR description.
  • Empty-region check: it moves into VerifyComplete with the same message as before. Both new TUnit tests cover the two failure cases.
  • Summary script: validation is strict and the aggregation is correct. Bool counts are rejected by the type(value) is not int check, and duplicate thread/type/stack keys are rejected. The 13 invalid-input cases cover the other branches. If a reader failure leaves a non-JSON trailer in the JSONL, json.loads raises ValueError, so the step still fails visibly.
  • Workflow and docs: the new step uses if: always() and sets failed=1 on any error, and the script is added to the path filter and the uploaded artifact. The docs page is updated in the same PR.

Non-blocking: if a profile file is missing, the summary step fails with a FileNotFoundError traceback. That is acceptable because it still fails, though a short message would be friendlier.

No actionable findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f3ecee0115

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

@thomhurst

Copy link
Copy Markdown
Owner Author

Rechecked all review surfaces for unchanged head f3ecee0: Claude CLEAR, Codex completed with no findings, no inline comments or review threads. Claude’s missing-file traceback suggestion is non-blocking: the existing exception already fails the summary step visibly, and no blocking fix requires another push. Keeping this reviewed head.

Reverified retained evidence inventories: all 38 thread-summary payloads and 2160 native-thread payloads match recorded lengths and SHA-256. Inventory hashes remain b0092a5f3577e35aa4fa485f1da7d76cd50cb15e36ddb33e094446d86fa97073 and f490f056e31379ce51ce52957170bf4436b1dc647fd20e2fc34e480be768c4cb respectively, at the independently retained issue-349 paths in the PR body. No new measurements claimed.

Automatic native investigation run 42765572754 is collecting separate measured-region profiles. Its non-CI control check must finish before protected promotion; no competing dispatch or rerun was started. This run exercises missing-stack rejection/retention and the owner summaries against the frozen images; it does not by itself establish historical exact allocation ownership. Normal protected promotion remains the next PR action after its results are inspected.

@thomhurst

Copy link
Copy Markdown
Owner Author

Pushed 34d7c8b: keep reader stderr and launcher failure messages in *-extraction.log rather than corrupting *-allocations.jsonl. The strict reader/summary failures and raw-trace retention remain intact. Regression tests assert parseable emitted records, separate diagnostics, continued launches and retained raw captures. All 25 focused Python tests passed; npm ci, production docs build and diff check passed. Production per-message cost remains unchanged, 0 B. Reuses existing subprocess streams and retention path; no native broker functionality duplicated.

Inspected retained artifact 13739299112 from failed run 42765572754. Exactly two launches rejected one stackless System.ArraySegment<byte> sample each (106600 sampled bytes each): 42310409459-profiled/1-baseline on thread 3797 and 42306276036-bdn-await-profiled/1-baseline on thread 3242. Both .nettrace captures and .nettrace.etlx indexes are retained. No event-loss exception preceded either measurement. These samples remain incomplete evidence, not exact byte ownership. The other 22 launches emitted complete records.

Next investigation: inspect the retained EventPipe stack references for these two ticks against the runtime/TraceEvent reader, to distinguish absent runtime stacks from conversion/lookup failure. Do not retry unchanged experiments for green or exclude the samples without evidence. The new head's automatic workflow will produce a fresh reviewed run with readable diagnostics; promotion still requires all applicable checks passing. No historical attribution or missing-stack root cause is claimed resolved.

Validation source/log archive: /Users/tom/git/Relayer-evidence/pr-433/34d7c8b4f2771abf026c3f19e97eb362e2d15d2a/ (six payload lengths and SHA-256 hashes reverified). Failed-run artifact downloaded independently to /Users/tom/git/Relayer-evidence/pr-433/run-42765572754/; hosted artifact retains the original inputs and captures for 90 days.

@codex review

@github-actions

Copy link
Copy Markdown

Review

I read the diff against the reader, the launcher and the workflow, and found no actionable issues.

  • Reader: Program.cs already counts samplesWithoutStacks and writes it into the measurement record. Calling VerifyComplete after all records are printed means a nonzero exit still leaves the parseable evidence behind. The launcher's existing failed-extraction path then keeps the trace and index. Both the missing-stack and empty-region cases are covered by the new TUnit tests.
  • Launcher: sending stderr to *-extraction.log keeps exception text out of the JSONL, which the summary script needs. The launcher test checks both files.
  • Summary script: it validates types, ordering, duplicates and a zero samplesWithoutStacks, and the tests cover the invalid cases. The workflow step runs under if: always(). A missing or rejected profile fails the step, which is the intended visible failure.
  • Performance and docs: the change is offline diagnostics only, so production per-message cost is unchanged. The performance page is updated in the same PR.
  • Evidence paths: the PR description points at local /Users/tom/... evidence archives. No evidence files are committed, which matches the rule against committing benchmark output.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 34d7c8b4f2

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

@thomhurst

thomhurst commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner Author

Current head 34d7c8b still has Claude CLEAR and Codex completed/no findings. Reviewed every review body, inline comment, conversation comment and GraphQL thread (none); two automated review rounds, no force-pushes. No code finding needs another push.

Inspected failed native run 42766418345 and artifact 13740206489. Twenty-two profiles are complete. Original-input async A1/A2 each have one stackless System.ArraySegment<byte> tick weighted at 106600 bytes; JSONL is parseable, separate extraction logs explain the rejection, and both raw traces/indexes remain retained. The implemented strict rejection and retention behave correctly. These weights do not identify the historical exact allocation owner.

A standalone direct-EventPipe probe replayed both captures, avoiding ETLX conversion. A1 has 1998 ticks, exactly one empty stack at 1978.750716 ms (pid 3340, thread 3352); A2 has 2003 ticks, exactly one empty at 1744.882597 ms (pid 3504, thread 3517). The raw parsed headers reference stored zero-byte stack entries (IDs 25 and 1 respectively), rather than unresolved symbols or ETLX-only lookup failures. A1 reproduces identically with pinned TraceEvent 3.1.21 and current 4.0.0. Existing open/closed issues, current sources and release notes were checked before filing dotnet/runtime#137240, with a self-contained reader and retained-capture reproduction. The precise runtime stack-walk cause remains unknown.

Upstream blocker: this applicable control check remains red because the captured runtime events have empty stacks. Added on-hold; remove it when upstream provides a fix or an evidenced explanation that allows a correct complete profile and a passing check. No samples were excluded, no failure was suppressed, no completeness requirement or threshold was weakened, no unchanged experiment was rerun, and the PR remains draft/unarmed. #349 has since closed as not planned; this independent diagnostic fix remains open (see triage audit below).

Verified independent evidence inventories against all payload lengths/SHA-256: /Users/tom/git/Relayer-evidence/pr-433/run-42766418345/ has 2193 payloads, inventory SHA-256 e4b7d4fc3f7ed8e5f58f548a6d2a88374871c32457cb82527852443a504b8d44; /Users/tom/git/Relayer-evidence/pr-433/raw-probe/ has 59 source/project/loaded-binary/replay-output payloads, inventory SHA-256 c0089212f15f7814cda7c3e025e359514ad524cfd28760f84bf3d3c074ab5ece. Hosted capture expires 2027-02-08. Offline replays are new diagnostic evidence, not recovery of the previously deleted historical traces. No production changes or performance trade-off.

Triage audit 2026-11-14 against origin/main f8fa53a3b655464b5d474b1c3edbdd419dc03ee6: dotnet/runtime#137240 remains OPEN with only automated area tagging and no upstream fix or explanation. The current PR still has a failed control check (run 42814404786); main still omits missing-stack completeness rejection. Keep on-hold until the documented native stack-capture condition is met. No experiment, threshold or gate was changed.

@thomhurst thomhurst added the on-hold Waiting for an external dependency or gate label Nov 10, 2026
@thomhurst
thomhurst force-pushed the issue-349-worker-profiles branch from 34d7c8b to fa6cb18 Compare November 10, 2026 12:16
@github-actions

Copy link
Copy Markdown

Review of PR 433

I found no blocking issues. This is offline diagnostic tooling, so per-message cost is unchanged and no benchmark is needed. The PR description states this.

Reader (Program.cs, AllocationGroups.VerifyComplete)

  • The check runs after the measurement record and allocation groups have been written to stdout. The launcher's existing failed-extraction path therefore keeps the trace and index, and the records emitted so far stay parseable. This fixes the defect where a missing stack returned success and the raw trace was deleted.
  • The two new TUnit tests cover both rejection branches and the success branch.

Launcher (frozen_concurrent_control.py)

  • Sending stderr to a separate *-extraction.log stops exception text from landing inside the JSONL. That is what let the summary tool parse the profile without hitting a traceback line.
  • The updated launcher test asserts both the diagnostics content and that the JSONL still parses.

Summary tool (frozen_profile_summary.py)

  • Validation is strict: it checks the measurement header, rejects bool values for counts, rejects duplicates and rejects any missing stack. The 13 invalid-profile cases cover this.
  • Owners are keyed by the complete type and stack, and thread IDs are kept per trace. The docs say plainly that sampled weights are not exact byte counts and that the boundary-marker flag is not a role.

Minor, non-blocking

  • In the workflow step Inspect thread-resolved…, > summary.json creates an empty file when a profile is rejected. Consider writing to a temp file and moving it only on success, so an artifact reader cannot mistake an empty file for a summary.
  • python3 -m unittest is invoked with an output redirect, so set -e semantics depend on the step's shell. This matches the existing line for the verifier tests, so it is consistent.
  • That step now fails by design for profiles with missing stacks. This is intended, since the step reports an incomplete investigation, and the docs describe it.

Docs are updated in the same PR. There is no new public API or diagnostic.

@thomhurst

Copy link
Copy Markdown
Owner Author

Maintainer decision: closing. #349 was closed as not planned, and this can't go green until dotnet/runtime#137240 is fixed. The branch stays if the stricter trace retention is wanted later.

@thomhurst thomhurst closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on-hold Waiting for an external dependency or gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant