← Back to Pull requests

dyninst: detach before unregistering sink #50726

Closed
unknown closed this pull request without merging on May 13, 2026 18:28 UTC
View on GitHub
unknown unknown commented on May 13, 2026 02:51 UTC
Author

What does this PR do?

loadedProgramImpl.Close previously called dispatcher.UnregisterSink before onProgramDetached. UnregisterSink synchronously drains the sink: sink.Close force-finalizes any buffered invocations and calls emit on each, which calls setProbeMaybeEmitting → diagnostics.reportEmitting. That lookup is keyed on procRuntimeIDbyProgramID, which onProgramDetached clears — but only after the drain has run, so the drain still reports "emitting" diagnostics for a runtimeID whose process has already been removed (and whose diagnostics tracker entries were just cleared by processStore.remove). The re-inserted entry has no future event that would ever clear it, so DiagnosticsStates never drains.

Fix: clear the programID→runtimeID mapping before draining the sink so the final-drain emits become no-ops at the lookup. Same fix applies to reportProbeError, which has the same lookup pattern.

Motivation

This surfaced as flakes in TestDropNotifications/S4_partial_return_under_pressure: the EventuallyWithT(... DiagnosticsStates ... Empty) assertion would time out with a stranded capture_bytes_return: [emitted] entry. S4 is the scenario most likely to hit this — a small entry that decodes cleanly sits buffered waiting on a PARTIAL_RETURN notification that may not arrive before shutdown, then force-finalizes and decodes successfully during sink.Close. S3 (entry-side drops) leaves no decodable entry; S5 (RETURN_LOST with huge entries) often has nothing decodable either; both hit emit()'s "nothing to decode" early return and skip the re-emit.

Describe how you validated your changes

It deflakes the test

Additional Notes

Diff: 213 lines (+159 / -54) across 2 files Reviewer: grantseltzer Review duration: 936m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 213 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.321
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #50726"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.6% (MEDIUM) · Higher = larger blast radius
36.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.8% · Safe to merge
15.8%