[pg19][#35965] YSQL: Purge globalChannelTable entries of a killed LISTEN backend #39744
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 229 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.325
Real PR Conversation Timeline
1 comments
"Review active on #39744"
general
weight: 0.35
arpang
Summary
pg19 keeps channel listeners in a DSA-backed dshash. When a LISTEN backend is killed, the postmaster calls
YbCleanupListenStateForProc(). The postmaster cannot attach to DSA (dsm_attach()assertsIsUnderPostmaster), so the entries of the killed listener stay inglobalChannelTable.SignalBackends()then hitsAssert(pid != InvalidPid).Changes:
SignalBackends()skips entries whose PID is invalid.YbCleanupListenStateForProc()sets a new per-slot flag,ybNeedsChannelPurge. The next backend with thatProcNumberthat registers as a listener removes the entries inybRemoveStaleListenerEntries()and clears the flag. Without the purge, that backend inheritsremoveOnAbort = false, skipsybOnListenCommit(), and its session never becomes sticky under Connection Manager.YbCleanupListenStateForProc()also resetsWAKEUP_PENDINGandIS_ADVANCING, asasyncQueueUnregister()does.Test plan
Debug build (clang21), each run with and without
YB_ENABLE_YSQL_CONN_MGR_IN_TESTS=true. The runs applied this change oneda8cc23810, the base of #38976, not on the currentpg19tip.testListenNotifyAfterPeerListenerCrashpasses with this PR alone. A second listener survives the kill, so the test does not reach the postmaster FATAL that #38976 fixes.testListenNotifyAfterSoloListenerCrash,testListenNotifyAfterPeerListenerCrash,testNotifyCommitAndNotifierCrashandtestNoPostmasterRestartAfterSoloListenerCrashpass. Under Connection Manager, the logs of the first three contain noalready initialized,TRAP:,terminating any other activeorbroken control connectionlines.