-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
LISTEN channel stops working due to postgres bug #3147
Comments
Just had this again. It seems the LISTEN on primary, conn pool on replicas thing makes it more likely to happen:
The Listener just kept retrying while slowing down requests since the connection pool was normal, only the Listener failed. Apparently, just running: select pg_terminate_backend(pid)
from pg_stat_activity
where application_name = 'postgrest'; On the primary made things work again, without the need to restart the pg instance. |
Since it's too hard to reproduce, we need to stop retrying the schema cache whenever the LISTENER fails. That would help mitigate the damage. Also related to #3313 (comment). |
To mitigate this, I think the easiest way would be to revert 4beac10 |
I see this issue too by using Backstage's event-backend plugin which relies on this feature. Any news to fix it? |
Problem
This just happened on a production instance.
NOTIFY pgrst
wasn't triggering a schema cache reload while according topg_stat_activity
theLISTEN
channel was up for several days:Further investigation lead to finding this PostgreSQL bug:
More details:
So seems the LISTEN channel is broken. I can't reproduce this locally though.
The only way to repair this error is by restarting the PostgreSQL instance AFAICT.
Workaround
Killing the LISTEN channel will force PostgREST to reload.
Further measures
Do we have any way to prevent this? Would a shorter lifetime in the LISTEN channel help?
The text was updated successfully, but these errors were encountered: