Postgrex FATAL 57P01

What could be the problem ?

[error] Postgrex.Protocol (#PID<0.3054.0>) disconnected: ** (Postgrex.Error) FATAL 57P01 (admin_shutdown) terminating connection due to administrator command

Thanks! :smiley:

I would guess someone or something with higher priority send a signal to terminate the postgres server, is it running local or on some cloud ?

1 Like

If this is a Postgres instance in the cloud, this might be an automatic Postgres upgrade.

This happens locally and in the cloud.

This happens locally and in the cloud

Could you connect to your local/cloud postgres instance via pgAdmin? Is it throwing error like that?

If it’s still throwing error like that when you use pgAdmin, then most likely there were problem on the database it self (this is out of my expertise though).

If it’s not throwing error when you use pgAdmin, then most likely your application is doing something which cause the database to shutdown when it’s starting up (i presume?), try looking around your start up code which connect to DB and try to isolate the cause.

Googling around for Postgrex FATAL 57P01, it seems like an issue that happen when there were somekind of error (like connection pool exceeded, memory usage over limit), and thus postgres supervisor terminate postgres process.

There were old issue in Oban library which record this Oban seems to be bringing down my application · Issue #72 · sorentwo/oban · GitHub . But the issue has since fixed.

This happens even when there is no query in the database

OP says it happens in cloud and locally, so installation might not be the problem, maybe the connection configuration, since the application is common between envs?

@Yurii could you paste your Repo configuration? parameters, pool size etc?

config :my_app, MyApp.Repo,
adapter: Ecto.Adapters.Postgres,
database: System.get_env(“MYAPP_DB_NAME”),
username: System.get_env(“MYAPP_DB_USERNAME”),
password: System.get_env(“MYAPP_DB_PASSWORD”),
hostname: System.get_env(“MYAPP_DB_HOST”),
types: MyApp.PostgresTypes,
pool: Ecto.Adapters.SQL.Sandbox,
size: 20

Are you using this pool in development? Are these configs in the dev.exs or in test.exs ? If you are using these at dev.exs remove the pool configuration and try again, this pool is for test only.

1 Like