57P02 — crash_shutdown
postmaster 因崩溃重启而令后端回滚退出。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Operator Intervention
- condition name
- crash_shutdown
- lang
- en
- sqlstate
- 57P02
版本定义 PG 18
57P02
速览 {#at-a-glance}
57P02 是 crash-shutdown 路径。crash-and-restart 周期开始时,backend 向客户端发送 client-only WARNING,说明 postmaster 命令其回滚并退出;随后由于共享内存可能已损坏,进程不运行正常清理回调而退出。
含义 {#meaning}
固定 primary 是 terminating connection because of crash of another server process。detail 说明 postmaster 因另一个服务器进程异常退出、可能破坏共享内存,而命令当前 server process 回滚并退出;hint 建议稍后重连。源码使用 WARNING_CLIENT_ONLY 而不是 FATAL,使信号处理器能先把消息发给客户端再强制进程退出。连接仍会关闭,之后不能在原 session 发送普通恢复命令。
消息 {#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 来源:
WARNING_CLIENT_ONLY,这是发给客户端但不写服务器日志的 warning;报告后进程退出。因此不能把它理解成可在同一 session 继续的语句级 WARNING。
诊断 {#diagnosis}
把 SQLSTATE 和完整诊断与 postmaster 崩溃/恢复日志、backend PID 及执行中的命令关联。源码明确要求回滚当前事务,但连接在 crash 周期中断开,重放非幂等请求前仍必须核对持久化业务状态。要和有序管理员 shutdown(57P01)及启动拒绝(57P03)区分。
处理 {#response}
不要在已断开的连接上发送 ROLLBACK,也不要人为制造崩溃测试此路径。等待 postmaster 恢复并 ready,建立新连接,检查持久化业务状态和受影响对象;只有在操作幂等或已确认先前效果后再重试。保留 primary/detail/hint 及服务器日志用于事故诊断。
版本 {#versions}
锁定目录从 7.4 记录此条件;该目录边界不等于精确实现引入版本。固定源码覆盖 PostgreSQL 18.6。
相关 {#related}
来源 {#sources}
src/backend/tcop/postgres.c#L2974-3001
src/include/utils/elog.h#L46-55
结构化证据记录保存固定消息以及源码/运行范围。
比较版本
SQLSTATE 证据与已记录的运行版本
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"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:eb15b8ea14647ba80ce77b2ffad78baf381f544a2a379640ef9d72e911f42994
正文语言: zh-Hans · english-manuals:eb15b8ea14647ba80ce77b2ffad78baf381f544a2a379640ef9d72e911f42994