Replies: 9 comments
|
This high rollback rate (~125k/min) accompanied by PostgREST request-context initialization ( Here is an explanation of the internal mechanics, why this happens, and the exact queries to isolate the traffic source. 1. Why PostgREST Initializes Context and Immediately Rolls BackIn PostgREST's request lifecycle:
2. Can This Originate from the Managed Service Itself?While possible (e.g. an internal service health check or a stuck connection pooler probe), in the vast majority of hosted Supabase cases this churn is external ingress traffic. Because every Supabase project has a public API URL ( 3. Safe Diagnostics to Identify the Exact SourceYou can identify the exact IP, User-Agent, and requested URLs without modifying database state or restarting services: A. Query Edge Logs in the Supabase DashboardGo to Dashboard -> Logs -> API Logs or Log Explorer and run: select
timestamp,
metadata.request.method as method,
metadata.request.path as path,
metadata.response.status_code as status,
metadata.request.headers.cf_connecting_ip as client_ip,
metadata.request.headers.user_agent as user_agent,
count(*) as request_count
from edge_logs
where timestamp > now() - interval '1 hour'
group by 1, 2, 3, 4, 5, 6
order by request_count desc
limit 50;Look for:
B. Check Active Database SessionsRun this in the SQL Editor to inspect live PostgREST transactions as they execute: select
pid,
usename,
client_addr,
application_name,
state,
query,
wait_event_type,
wait_event,
now() - state_change as duration
from pg_stat_activity
where usename in ('authenticator', 'anon')
or application_name like '%postgrest%'
order by state_change asc;4. Resolution
If this analysis helps clarify the rollback spikes and diagnostic path, please feel free to mark this as the accepted answer. |
|
We ran a synchronized read-only observation window from 2026-09-16 05:33:20.531865 UTC to 05:34:38.350308 UTC (77.82 seconds).
|
|
That 77.8-second synchronized observation window is extremely revealing. The fact that Here is the exact architectural breakdown of why this bypasses 1. Why
|
|
Hi Supabase Support, I have a new synchronized read-only observation that further narrows the issue. The rollback storm is still active. In a synchronized ~31.9-second window: xact_rollback increased by 65,703 This is approximately: 123.6k rollbacks/min So in this window, PostgREST request-context initialization tracked the rollback increase at roughly 99.7%. Live pg_stat_activity during the storm showed local: usename = authenticator and the active RPC was repeatedly: public.synthetic_authority_append(...) with the paired backend also observed in ABORT / idle-in-transaction cycles. This materially narrows the problem: the dominant churn appears to be a PostgREST request loop around synthetic_authority_append, not normal application business traffic. One important nuance: client_addr = ::1 only proves the PostgREST-to-Postgres connection is local. It does not identify the upstream caller that is continuously feeding the RPC into PostgREST. Earlier synchronized Logs Explorer windows showed 0 Edge/API Gateway requests while the rollback storm was active, so the remaining question is: What upstream process/client can continuously invoke this RPC through managed PostgREST while normal Edge/API ingress logs show zero requests? I have intentionally not killed sessions, revoked the function, reset stats, or changed schema/configuration yet, in order to preserve evidence. Historical reference: SU-474601 Thank you. |
|
Hi Supabase Support, We have now completed a read-only caller-identification pass and a reversible causal isolation test. The most important new evidence is: public.synthetic_authority_append(...) was created as a synthetic RPC harness on 2026-09-07 around 11:42 UTC. This establishes that PostgREST-callable exposure of this RPC was causally necessary for the storm, but it does not identify the internal mechanism that sustained the requests. The strongest remaining hypothesis is a stuck/replayed/pathological managed PostgREST request lifecycle triggered after the original timed-out server-side HTTP requests, although we cannot prove that mechanism from database-level evidence alone. Could you please investigate whether PostgREST 14.5 or the managed Supabase request stack can retain/replay/re-enter an RPC request after the originating HTTP client times out or disconnects? We are intentionally keeping this synthetic RPC disabled and will not re-enable it merely for diagnosis. Ticket: SU-475687 |
|
Your causal isolation test—confirming that revoking Here is the exact internal mechanism in PostgREST that explains how two timed-out 1. The PostgREST Internal Transaction Retry LoopPostgREST is written in Haskell and uses the
2. Why
|
|
We have now found official Supabase and upstream PostgREST documentation matching our incident exactly. Supabase’s troubleshooting article states that custom SQLSTATE 40001 in an RPC can cause infinite retries in PostgREST 14, and that the bug is fixed in PostgREST 16. Our affected project was observed running PostgREST 14.5. This matches our incident: one synthetic RPC request path We are keeping the synthetic RPC disabled. Please confirm: whether this managed project can be moved from PostgREST 14.5 to the fixed PostgREST 16 version, and Ticket: SU-475687. |
|
Glad to hear the official Supabase and upstream PostgREST documentation confirmed the exact Here are the direct answers to your two questions: 1. Moving the Managed Project from PostgREST 14.5 to PostgREST 16On hosted Supabase, the PostgREST version is bundled with the platform image / PostgreSQL release:
2. Replacing the Expected-Version Conflict Code (
|
|
Before adding another hypothesis, two things about the measurement, because I think the numbers as stated are doing some of the confusing. 1. PostgREST sets several request-context settings per request. If the ~97,974/min "transaction-init rate" was derived from select calls, query
from pg_stat_statements
where query ilike '%set_config%'
order by calls desc limit 5;If one statement carries all the settings, calls ≈ requests. If there are several rows moving in lockstep, divide. The transaction count itself is unambiguous, though — take deltas of 2. The commit:rollback ratio is the actual anomaly, and it rules a lot out. Per the PostgREST transaction docs, a request ends in
That third one is the case people skip, and it is the one that fits "no application traffic" best: a backend that disconnects with a transaction open increments The bisection that settles it, and it is two queries plus one log view:
For the third row specifically: select count(*), state, application_name,
min(now() - backend_start) as youngest,
max(now() - backend_start) as oldest
from pg_stat_activity
where usename in ('authenticator','anon')
group by state, application_name;Sample that a few times a second during a burst. If One note on the external-scanner theory above: I would want evidence before accepting it. PostgREST resolves an unknown path against its in-memory schema cache and answers 404 without opening a database transaction, so path-scanning from outside should not move |
Uh oh!
There was an error while loading. Please reload this page.
I am seeing extremely high transaction/rollback churn on a managed Supabase project even when application traffic is negligible.
Environment
ACTIVE_HEALTHYWhat I observed
During a bounded 43.304-second read-only observation window:
The dominant statement pattern was PostgREST request-context initialization using
set_config(...), including request role/context fields.The observed connections were associated with:
PostgREST 14.5authenticatoranonThe activity appears to occur before an identifiable application business RPC/query is executed.
Application traffic comparison
Our actual business/RPC calls are only in the tens of cumulative calls and are orders of magnitude smaller than the PostgREST initialization activity.
The application does have normal polling:
However, during a separate five-minute application/Sites observation window, visible application requests were zero while the database churn continued.
No application retry loop was found.
Additional observation
The churn appears to be bursty/intermittent, not continuously flat.
A later 10-second sample showed zero new commits/rollbacks, but over approximately 64 minutes the cumulative rollback counter still increased by about 7.8 million.
So short quiet samples can occur even while the longer-period transaction counter grows extremely quickly.
What I have NOT changed
I have intentionally not:
I am trying to identify the source before applying any workaround.
Question
Has anyone seen a managed Supabase/PostgREST instance generate this kind of request-context initialization / rollback churn with almost no corresponding application traffic?
In particular, I would like to understand:
Supabase support ticket already opened:
SU-474601.No credentials, API keys, tokens, or private project identifiers are included here.
All reactions