[#36081] YSQL: Release LWLocks in the notifications poller's error handler #38390
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 182 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.312
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #38390"
general
weight: 0.35
arpang
Summary
Fixes #36081.
If the notifications poller hits an ERROR while holding
NotifyQueueLock(for example, an SLRU I/O failure inasyncQueueAddEntries), thePG_CATCHinybNotifsPollerLooptries to takeNotifyQueueLockagain for its stale-poller check. LWLocks are not re-entrant, so the poller waits on itself forever:statement_timeoutand cancel do not interrupt an LWLock wait, so the only recovery is killing the poller, which restarts all backends on the node.The fix calls
LWLockReleaseAll()at the start of the catch block. The block always ends inproc_exit, whoseShutdownPostgresaborts the open transaction, so nothing else needs cleanup there.Adds the test-only GUC
yb_test_notifs_poller_error_holding_queue_lock(defaultfalse), which raises an ERROR right after the poller takesNotifyQueueLock. The test sets it throughysql_pg_conf_csv, so no new gflag is added.Test plan
./yb_build.sh release --java-test 'org.yb.pgsql.TestPgListenNotify#testPollerErrorHoldingQueueLock'passes (macOS arm64, release). The poller logs the injected error and exits, and the listener getsFATAL: notifications poller encountered a fatal error.LWLockReleaseAll()removed), the same test fails: the poller never exits andwaitForPollerAndSlotCleanuptimes out after 2 minutes.