↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / SQLSTATE

57P02 — crash_shutdown

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.

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

aliases
Unknown
class name
Operator Intervention
condition name
crash_shutdown
lang
en
sqlstate
57P02

Definition PG 18

57P02

At a glance {#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 {#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 {#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 {#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 {#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 {#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.

Related {#related}

57P01, 57P03, 08006

Sources {#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.

Compare versions

SQLSTATE evidence and recorded runtime versions

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "57P02 is crash_shutdown in SQLSTATE Class 57."
}
claims · resolved-paths
{
  "claim_id": "resolved-paths",
  "limits": "Source confirmation is not natural runtime.",
  "method": "Read complete fixed source contexts.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.0",
    "src.path.1"
  ],
  "statement": "The cited PostgreSQL 18.6 source paths support the concrete phase, message, and lifecycle boundary described."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 57P02 from 7.4; that boundary does not prove exact implementation introduction."
}
messages · message.0
{
  "limits": "",
  "message_id": "message.0",
  "path": "",
  "position": 0,
  "raw": {
    "detail_template": "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_template": "In a moment you should be able to reconnect to the database and repeat your command.",
    "id": "message.0",
    "primary_template": "terminating connection because of crash of another server process",
    "severity_source": "WARNING_CLIENT_ONLY (client-visible warning; process exits after reporting)",
    "sources": [
      "src.path.0",
      "src.path.1"
    ],
    "sqlstate": "57P02"
  },
  "severity": "WARNING_CLIENT_ONLY (client-visible warning; process exits after reporting)",
  "sources": [
    "src.path.0",
    "src.path.1"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "terminating connection because of crash of another server process",
      "position": 0,
      "role": "",
      "template": "terminating connection because of crash of another server process"
    },
    {
      "kind": "detail",
      "literal": "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.",
      "position": 1,
      "role": "",
      "template": "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."
    },
    {
      "kind": "hint",
      "literal": "In a moment you should be able to reconnect to the database and repeat your command.",
      "position": 2,
      "role": "",
      "template": "In a moment you should be able to reconnect to the database and repeat your command."
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L436"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/tcop/postgres.c",
  "position": 1,
  "sha256": "9fb62275b1badf94d01ab351337b60410cd9b3ab1fe63fa9f23d6d2185a21061",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/tcop/postgres.c#L2987"
}
sources · src.path.1
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/include/utils/elog.h",
  "position": 2,
  "sha256": "3485d4a046bd4fcc5f5887f7ea9badc3f430f1bd67c4b103d3e3a6fa54b38bc0",
  "source_id": "src.path.1",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/utils/elog.h#L46"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:eb15b8ea14647ba80ce77b2ffad78baf381f544a2a379640ef9d72e911f42994

Text language: en · english-manuals:eb15b8ea14647ba80ce77b2ffad78baf381f544a2a379640ef9d72e911f42994