百科 / 错误代码 / Class 57 操作员干预
57P02 crash_shutdown
ERROR 源码确认 参考 未实测
- 条件名
crash_shutdown- 宏名称
ERRCODE_CRASH_SHUTDOWN- 启用版本
- 7.4
- 状态
- 活跃
版本覆盖
速览
57P02 是 crash-shutdown 路径。crash-and-restart 周期开始时,backend 向客户端发送 client-only WARNING,说明 postmaster 命令其回滚并退出;随后由于共享内存可能已损坏,进程不运行正常清理回调而退出。
含义
固定 primary 是 terminating connection because of crash of another server process。detail 说明 postmaster 因另一个服务器进程异常退出、可能破坏共享内存,而命令当前 server process 回滚并退出;hint 建议稍后重连。源码使用 WARNING_CLIENT_ONLY 而不是 FATAL,使信号处理器能先把消息发给客户端再强制进程退出。连接仍会关闭,之后不能在原 session 发送普通恢复命令。
消息
- 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。
报文模板
源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。
terminating connection because of crash of another server process
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.
In a moment you should be able to reconnect to the database and repeat your command.
来源:src/backend/tcop/postgres.c @ REL_18_6 · src/include/utils/elog.h @ REL_18_6
诊断
把 SQLSTATE 和完整诊断与 postmaster 崩溃/恢复日志、backend PID 及执行中的命令关联。源码明确要求回滚当前事务,但连接在 crash 周期中断开,重放非幂等请求前仍必须核对持久化业务状态。要和有序管理员 shutdown(57P01)及启动拒绝(57P03)区分。
处理
不要在已断开的连接上发送 ROLLBACK,也不要人为制造崩溃测试此路径。等待 postmaster 恢复并 ready,建立新连接,检查持久化业务状态和受影响对象;只有在操作幂等或已确认先前效果后再重试。保留 primary/detail/hint 及服务器日志用于事故诊断。
版本
锁定目录从 7.4 记录此条件;该目录边界不等于精确实现引入版本。固定源码覆盖 PostgreSQL 18.6。
来源
- 上游源码 src/backend/utils/errcodes.txt 第 436 行
- 上游源码 src/backend/tcop/postgres.c 第 2987 行
- 上游源码 src/include/utils/elog.h 第 46 行
证据
断言
每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。
-
57P02 is crash_shutdown in SQLSTATE Class 57.
-
The cited PostgreSQL 18.6 source paths support the concrete phase, message, and lifecycle boundary described.
-
The locked catalogue records 57P02 from 7.4; that boundary does not prove exact implementation introduction.
同类错误代码
Class 57 操作员干预 下的其他成员。