You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Query timeout followed by health-check disconnect after repeated cancellations #163
On macOS with Tabularis 0.29.0, opening a small PostgreSQL table and running the corresponding SELECT manually both hang until the following error appears:
Plugin call 'execute_query' timed out after 120s
While the affected query was pending, a query against another table completed normally. After repeated attempts and cancellations, two consecutive health-check pings timed out and Tabularis disconnected the connection.
Expected behavior
Queries should complete or return an actionable error without preventing subsequent requests from completing.
Additional context
Possibly related to #160. The root cause has not been confirmed. The exact PostgreSQL plugin version still needs to be recorded.
@albertorizzi — thanks, this is very useful and confirms what we're seeing in #160.
Two details from your report line up exactly with the mechanism we've traced:
"a small table" hangs while "a query against another table completed normally" — this is the key signal. The hang is table-specific, driven by column types, not size. Tables with only built-in types (int, text, timestamptz, …) work; tables with at least one non-builtin type (custom enum, composite, domain, or an extension type like citext or Supabase's auth.uid) hang. Could you confirm: does the hanging table have any enum, custom domain, composite, or extension-defined column type? \d <table> in psql or the column list in Supabase's Table Editor will show it.
Tabularis 0.29.0 still hangs — this matters: 0.29.0 is the first version with the host-side pooler_mode field (#1128), and it does not fix this. That rules out the pooler_mode gate as a fix on its own, which matches our current diagnosis.
The root cause (source-confirmed in tokio-postgres 0.7.18): in rc.9 (#149) we switched queries to the unnamed extended-query protocol. On the non-empty-rows path, tokio-postgres resolves each column's type during the response drain, and for non-builtin types it fires an internal named typeinfo_statement round-trip interleaved into that drain — which deadlocks on poolers that don't expect an out-of-order named statement mid-stream. rc.8's named path resolved types in a separate pre-Execute window, so it never interleaved. This is tracked as the same bug as #160; fix is in progress on branch fix/table-hang-pooler-160.
One ask: the cascading part of your report — repeated cancellations → two health-check pings timed out → Tabularis disconnected — looks like a separate (secondary) issue in cancel/health-check handling rather than the query hang itself. Worth confirming: once we fix the hang, does the disconnect cascade still happen, or was it only ever a consequence of queries piling up? If it reproduces without a hanging query in play, please file it as its own issue so we can keep the two clean.
Thanks for the explanation. I can confirm that the affected table contains a custom PostgreSQL enum column.
We observed the disconnect cascade only after queries hung and were repeatedly retried/cancelled. We have not reproduced it independently of a hanging query. We can retest once the fix is available.
Update: the fix is on draft PR #164 and available for testing on branch fix/table-hang-pooler-160.
To confirm the mechanism, here's what we verified:
Your table's custom enum column is exactly the trigger — tables with only built-in types work through the same pooler.
The root cause is tokio-postgres's internal prepared-statement handling for non-builtin column types under transaction-mode poolers, not your query or table size.
Two things to try once the build is ready:
Set the connection's Pooler Mode to "Transaction" in Tabularis. This activates the plugin's transaction-pooler-safe query path (pins the backend, clears stale statements, resolves column types before the data fetch). This is the plugin-side fix.
If your pooler is PgBouncer-style, also set max_prepared_statements > 0 in pgbouncer.ini. This makes the pooler track prepared statements across reassignment — the best pooler-side fix, and it works without the plugin change too.
If the hang persists after both, please share your pooler type (PgBouncer / Supavisor / other) and version, and whether max_prepared_statements is configurable on it. The disconnect cascade you saw should also disappear once the queries stop hanging — if it reproduces without a hanging query, that's a separate issue worth filing on its own.
The query hang here has the same root cause as #160 (tokio-postgres's internal typeinfo_statement colliding across pooler backend reassignment on non-builtin column types), and the fix shipped in #164 (merged): a pinned one-shot transaction path for connections marked Pooler Mode = "Transaction" that pre-resolves column types while the backend is pinned and runs the unnamed-protocol data fetch.
On the health-check disconnect: the PR's analysis is that the two consecutive health-check timeouts you saw were downstream fallout from the repeated hung/cancelled queries (a hung query holds the pooler backend; repeated cancellations stack), not an independent bug. The pinned path removes the hang, so the disconnect trigger should be gone with it.
This is being released today in v1.0.0-rc.11.
If the query hang or the health-check disconnect still reproduces on rc.11 (with the connection's Pooler Mode set to "Transaction"), please open a new issue — especially if the disconnect reproduces without a preceding hung query, which would make it an independent bug rather than downstream fallout, and we'd want to chase it separately.
Follow-up: the rc.11 fix (#164) was incomplete for direct connections — see the note on #160. The query hang has the same root cause (a tokio-postgres typeinfo_statement interleave during Row deserialization that deadlocks on any connection once the response is large enough, not just pooler reassignment), and #164 only pre-resolved for Pooler Mode = "Transaction", leaving direct connections on the old hanging path (#166). A fix is in progress on fix/direct-enum-hang-166 that extends the pre-resolve to direct connections.
On the health-check disconnect: as noted in the #164 analysis, the two consecutive health-check timeouts were downstream fallout from repeated hung/cancelled queries, not an independent bug. The worker-pool starvation that let stuck queries block the health-check pings is tracked separately in #167 (a src/main.rs architecture change — dedicated lanes for ping/connect — that deserves its own design). If either the hang or the disconnect still reproduces after the direct-connection fix lands, please open a new issue.
Activity
aesslinger commentedon Oct 22, 2026
@albertorizzi — thanks, this is very useful and confirms what we're seeing in #160.
Two details from your report line up exactly with the mechanism we've traced:
int,text,timestamptz, …) work; tables with at least one non-builtin type (customenum, composite, domain, or an extension type likecitextor Supabase'sauth.uid) hang. Could you confirm: does the hanging table have anyenum, custom domain, composite, or extension-defined column type?\d <table>in psql or the column list in Supabase's Table Editor will show it.pooler_modefield (#1128), and it does not fix this. That rules out thepooler_modegate as a fix on its own, which matches our current diagnosis.The root cause (source-confirmed in tokio-postgres 0.7.18): in rc.9 (#149) we switched queries to the unnamed extended-query protocol. On the non-empty-rows path, tokio-postgres resolves each column's type during the response drain, and for non-builtin types it fires an internal named
typeinfo_statementround-trip interleaved into that drain — which deadlocks on poolers that don't expect an out-of-order named statement mid-stream. rc.8's named path resolved types in a separate pre-Execute window, so it never interleaved. This is tracked as the same bug as #160; fix is in progress on branchfix/table-hang-pooler-160.One ask: the cascading part of your report — repeated cancellations → two health-check pings timed out → Tabularis disconnected — looks like a separate (secondary) issue in cancel/health-check handling rather than the query hang itself. Worth confirming: once we fix the hang, does the disconnect cascade still happen, or was it only ever a consequence of queries piling up? If it reproduces without a hanging query in play, please file it as its own issue so we can keep the two clean.
albertorizzi commentedon Oct 22, 2026
Thanks for the explanation. I can confirm that the affected table contains a custom PostgreSQL enum column.
We observed the disconnect cascade only after queries hung and were repeatedly retried/cancelled. We have not reproduced it independently of a hanging query. We can retest once the fix is available.
fix: pin backend for transaction-pooler result queries (#160, #163)
aesslinger commentedon Oct 22, 2026
Update: the fix is on draft PR #164 and available for testing on branch
fix/table-hang-pooler-160.To confirm the mechanism, here's what we verified:
enumcolumn is exactly the trigger — tables with only built-in types work through the same pooler.Two things to try once the build is ready:
Set the connection's Pooler Mode to "Transaction" in Tabularis. This activates the plugin's transaction-pooler-safe query path (pins the backend, clears stale statements, resolves column types before the data fetch). This is the plugin-side fix.
If your pooler is PgBouncer-style, also set
max_prepared_statements > 0inpgbouncer.ini. This makes the pooler track prepared statements across reassignment — the best pooler-side fix, and it works without the plugin change too.If the hang persists after both, please share your pooler type (PgBouncer / Supavisor / other) and version, and whether
max_prepared_statementsis configurable on it. The disconnect cascade you saw should also disappear once the queries stop hanging — if it reproduces without a hanging query, that's a separate issue worth filing on its own.test: cover pooler_error_lead phrasing + pooler_mode whitespace (#160, …
refactor: parameterize build_search_path_sql + fix pinned-txn doc dri…
test: guard routing false side + correct vacuous discard-claim comment (
fix: skip redundant startup-script preflight on one-shot pool path (#160
fix: pin backend for transaction-pooler result queries on non-builtin…
aesslinger commentedon Oct 22, 2026
The query hang here has the same root cause as #160 (tokio-postgres's internal
typeinfo_statementcolliding across pooler backend reassignment on non-builtin column types), and the fix shipped in #164 (merged): a pinned one-shot transaction path for connections marked Pooler Mode = "Transaction" that pre-resolves column types while the backend is pinned and runs the unnamed-protocol data fetch.On the health-check disconnect: the PR's analysis is that the two consecutive health-check timeouts you saw were downstream fallout from the repeated hung/cancelled queries (a hung query holds the pooler backend; repeated cancellations stack), not an independent bug. The pinned path removes the hang, so the disconnect trigger should be gone with it.
This is being released today in
v1.0.0-rc.11.If the query hang or the health-check disconnect still reproduces on rc.11 (with the connection's Pooler Mode set to "Transaction"), please open a new issue — especially if the disconnect reproduces without a preceding hung query, which would make it an independent bug rather than downstream fallout, and we'd want to chase it separately.
chore: release 1.0.0-rc.11
chore: release 1.0.0-rc.11 (#165)
aesslinger commentedon Oct 23, 2026
Follow-up: the rc.11 fix (#164) was incomplete for direct connections — see the note on #160. The query hang has the same root cause (a tokio-postgres
typeinfo_statementinterleave duringRowdeserialization that deadlocks on any connection once the response is large enough, not just pooler reassignment), and #164 only pre-resolved for Pooler Mode = "Transaction", leaving direct connections on the old hanging path (#166). A fix is in progress onfix/direct-enum-hang-166that extends the pre-resolve to direct connections.On the health-check disconnect: as noted in the #164 analysis, the two consecutive health-check timeouts were downstream fallout from repeated hung/cancelled queries, not an independent bug. The worker-pool starvation that let stuck queries block the health-check pings is tracked separately in #167 (a
src/main.rsarchitecture change — dedicated lanes forping/connect— that deserves its own design). If either the hang or the disconnect still reproduces after the direct-connection fix lands, please open a new issue.fix: address pre-handoff-review findings on #173 classifier and routing
fix: keep bare [SET/CREATE TEMP, SELECT] batch on the shared client o…
fix: surface prepare errors inside an open transaction instead of cas…
fix: surface prepare errors inside an open transaction instead of cas…