select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 57 · OPERATOR INTERVENTION

crash_shutdown

SQLSTATE
57P02
Condition name
crash_shutdown
Class
Operator Intervention
Source macro
ERRCODE_CRASH_SHUTDOWN
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>57P02</h1>

At a glance

57P02 is the crash-shutdown path. When a crash-and-restart cycle is in progress, the backend sends a client-only WARNING describing the postmaster command to roll back and exit, then exits without running normal cleanup callbacks because shared memory may be corrupted.

Meaning

The fixed primary is terminating connection because of crash of another server process. Its detail says the postmaster ordered rollback and exit because another server process exited abnormally and possibly corrupted shared memory; its hint says to reconnect in a moment. The source uses WARNING_CLIENT_ONLY rather than FATAL so the signal handler can report to the client before forcing the process exit. The connection nevertheless closes, and no ordinary session-level recovery command can be sent afterward.

Messages

  • Primary: terminating connection because of crash of another server process.
  • Detail: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
  • Hint: In a moment you should be able to reconnect to the database and repeat your command.
  • Severity source: WARNING_CLIENT_ONLY, a client-visible warning that is not sent to the server log; process exit follows the report. It is therefore not a claim that this path is a recoverable statement-level WARNING.

Diagnosis

Correlate the SQLSTATE and full diagnostic with postmaster crash/recovery logs, backend PID, and the command in flight. The source explicitly orders rollback of the current transaction, but the client still must verify durable business state before replaying a non-idempotent request because the connection dies during the crash cycle. Distinguish this condition from orderly administrator shutdown (57P01) and startup refusal (57P03).

Response

Do not try to send ROLLBACK on the dead connection or manufacture a crash to test the path. Wait for postmaster recovery/readiness, establish a new connection, inspect durable business state and affected objects, and retry only after the operation is idempotent or its prior effect is known. Preserve the primary/detail/hint and server logs for incident diagnosis.

Versions

The locked catalogue records this condition from 7.4; that boundary does not prove the exact implementation-introduction version. Fixed source coverage is PostgreSQL 18.6.

Sources

src/backend/tcop/postgres.c#L2974-3001

src/include/utils/elog.h#L46-55

The structured evidence record records the fixed message and the source/runtime boundary.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

57P02 is crash_shutdown in SQLSTATE Class 57.

Method: Read fixed definition.

src.errcodes.18.6

The cited PostgreSQL 18.6 source paths support the concrete phase, message, and lifecycle boundary described.

Method: Read complete fixed source contexts.

Limits: Source confirmation is not natural runtime.

src.path.0 src.path.1

The locked catalogue records 57P02 from 7.4; that boundary does not prove exact implementation introduction.

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

WARNING_CLIENT_ONLY (client-visible warning; process exits after reporting) · message.0

Primary

terminating connection because of crash of another server process

Detail

The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.

Hint

In a moment you should be able to reconnect to the database and repeat your command.

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:c590d9659850fe2e4c65c0cd555… · English manual source