53200 \u2014 out_of_memory
内存分配失败,涵盖会话内存与共享内存不足。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Insufficient Resources
- condition name
- out_of_memory
- lang
- en
- sqlstate
- 53200
版本定义 PG 18
53200
速览 {#at-a-glance}
53200 是 PostgreSQL 的内存不足条件。固定调用者包括普通 memory context 分配、共享内存和锁表容量、扩展/统计文件读取以及 WAL 读取处理器;应诊断具体操作和分配上下文,不能把所有内存失败归为一个原因。
含义 {#meaning}
固定源码有几类不同边界:MemoryContextAllocationFailure 报告带请求大小和 memory context 名称的 out of memory;ShmemAlloc 和锁表建立路径报告 out of shared memory,后者可能提示 max_locks_per_transaction。扩展路径把操作写入 detail:pg_stat_statements 以 out of memory 记录文件读取分配失败,WAL reader 也以相同 primary 搭配分配 detail。pg_stat_statements 这一分支的 severity 是 LOG,并从加载器返回,因此不等同于使客户端当前事务中止的 ERROR;核心和 WAL reader 的 ERROR 分支才需要正常事务恢复。两阶段事务源码路径实际是 WAL reader 分配路径,不能据此说达到 max_prepared_transactions 本身就发出 53200。
诊断 {#diagnosis}
保留 severity、primary、detail、hint、操作、backend 和服务器日志,判断是在 backend memory context、共享内存/锁表、文件/统计结构还是 WAL reader 分配。若 primary 为 out of shared memory 且 hint 指向 max_locks_per_transaction,检查持锁事务与锁表配置;提高它会在启动时消耗共享内存。不要只凭 SQLSTATE 推断主机内存。
处理 {#response}
确认平台限制和影响后,再降低或重塑操作、释放应用压力或调整消息指向的容量。先结束或回滚持有过多锁的事务,再考虑调整 max_locks_per_transaction;该 hint 不等于操作系统 OOM。文件/WAL/统计操作失败后先验证对象。核心/WAL reader 的 ERROR 会使显式事务失败,重试前执行 ROLLBACK 或 ROLLBACK TO SAVEPOINT;自动提交只有在分配原因修复后才能重试。pg_stat_statements 的 LOG 分支属于后台加载器,本身不要求客户端恢复事务。本页不在真实主机制造 OOM。
版本 {#versions}
锁定目录从 7.4 记录;引用扩展和核心路径来自 PostgreSQL 18.6,未执行 OOM 运行。
相关 {#related}
来源 {#sources}
contrib/pg_stat_statements/pg_stat_statements.c#L2340-L2350
contrib/pg_walinspect/pg_walinspect.c#L121-L124
src/backend/access/transam/twophase.c#L1417-L1420
src/backend/utils/mmgr/aset.c#L444-L453
src/backend/utils/mmgr/mcxt.c#L1157-L1167
src/backend/storage/ipc/shmem.c#L151-L162
src/backend/storage/lmgr/lock.c#L2957-L2969
结构化证据记录保存固定消息以及源码/运行边界。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read fixed definition.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "53200 is out_of_memory in SQLSTATE Class 53."
}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",
"src.path.2",
"src.path.3",
"src.path.4",
"src.path.5",
"src.path.6"
],
"statement": "The cited PostgreSQL 18.6 source paths support the representative resource and object-state mechanisms described."
}claims · allocator-and-capacity
{
"claim_id": "allocator-and-capacity",
"limits": "",
"method": "Read the complete fixed allocator, shared-memory, and lock-table guards.",
"position": 2,
"runtime": [],
"sources": [
"src.path.3",
"src.path.4",
"src.path.5",
"src.path.6"
],
"statement": "Core memory-context allocation uses 53200 for allocator failure, shared-memory allocation uses an out-of-shared-memory primary, and lock-table exhaustion can add a max_locks_per_transaction hint; these contexts are distinct from extension file/WAL allocation details."
}claims · message-roles
{
"claim_id": "message-roles",
"limits": "",
"method": "Read fixed report groups and complete source contexts.",
"position": 3,
"runtime": [],
"sources": [
"src.calls.REL_18_6"
],
"statement": "The source report groups keep out of memory as the primary and the operation-specific allocation text as DETAIL; the pg_stat_statements group is LOG while the WAL reader groups are ERROR."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue boundary.",
"position": 4,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 53200 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": "Could not allocate enough memory to read file \"%s\".",
"id": "message.0",
"primary_template": "out of memory",
"severity_source": "LOG",
"sources": [
"src.path.0"
],
"sqlstate": "53200"
},
"severity": "LOG",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "out of memory",
"position": 0,
"role": "",
"template": "out of memory"
},
{
"kind": "detail",
"literal": "Could not allocate enough memory to read file \" \".",
"position": 1,
"role": "",
"template": "Could not allocate enough memory to read file \"%s\"."
}
]
}messages · message.1
{
"limits": "",
"message_id": "message.1",
"path": "",
"position": 1,
"raw": {
"detail_template": "Failed while allocating a WAL reading processor.",
"id": "message.1",
"primary_template": "out of memory",
"severity_source": "ERROR",
"sources": [
"src.path.1"
],
"sqlstate": "53200"
},
"severity": "ERROR",
"sources": [
"src.path.1"
],
"templates": [
{
"kind": "primary",
"literal": "out of memory",
"position": 0,
"role": "",
"template": "out of memory"
},
{
"kind": "detail",
"literal": "Failed while allocating a WAL reading processor.",
"position": 1,
"role": "",
"template": "Failed while allocating a WAL reading processor."
}
]
}messages · message.2
{
"limits": "",
"message_id": "message.2",
"path": "",
"position": 2,
"raw": {
"detail_template": "Failed while allocating a WAL reading processor.",
"id": "message.2",
"primary_template": "out of memory",
"severity_source": "ERROR",
"sources": [
"src.path.2"
],
"sqlstate": "53200"
},
"severity": "ERROR",
"sources": [
"src.path.2"
],
"templates": [
{
"kind": "primary",
"literal": "out of memory",
"position": 0,
"role": "",
"template": "out of memory"
},
{
"kind": "detail",
"literal": "Failed while allocating a WAL reading processor.",
"position": 1,
"role": "",
"template": "Failed while allocating a WAL reading processor."
}
]
}messages · message.3
{
"limits": "",
"message_id": "message.3",
"path": "",
"position": 3,
"raw": {
"detail_template": "Failed while creating memory context \"%s\".",
"id": "message.3",
"primary_template": "out of memory",
"severity_source": "ERROR",
"sources": [
"src.path.3"
],
"sqlstate": "53200"
},
"severity": "ERROR",
"sources": [
"src.path.3"
],
"templates": [
{
"kind": "primary",
"literal": "out of memory",
"position": 0,
"role": "",
"template": "out of memory"
},
{
"kind": "detail",
"literal": "Failed while creating memory context \" \".",
"position": 1,
"role": "",
"template": "Failed while creating memory context \"%s\"."
}
]
}messages · message.4
{
"limits": "",
"message_id": "message.4",
"path": "",
"position": 4,
"raw": {
"detail_template": "Failed on request of size %zu in memory context \"%s\".",
"id": "message.4",
"primary_template": "out of memory",
"severity_source": "ERROR",
"sources": [
"src.path.4"
],
"sqlstate": "53200"
},
"severity": "ERROR",
"sources": [
"src.path.4"
],
"templates": [
{
"kind": "primary",
"literal": "out of memory",
"position": 0,
"role": "",
"template": "out of memory"
},
{
"kind": "detail",
"literal": "Failed on request of size u in memory context \" \".",
"position": 1,
"role": "",
"template": "Failed on request of size %zu in memory context \"%s\"."
}
]
}messages · message.5
{
"limits": "",
"message_id": "message.5",
"path": "",
"position": 5,
"raw": {
"id": "message.5",
"primary_template": "out of shared memory (%zu bytes requested)",
"severity_source": "ERROR",
"sources": [
"src.path.5"
],
"sqlstate": "53200"
},
"severity": "ERROR",
"sources": [
"src.path.5"
],
"templates": [
{
"kind": "primary",
"literal": "out of shared memory ( u bytes requested)",
"position": 0,
"role": "",
"template": "out of shared memory (%zu bytes requested)"
}
]
}messages · message.6
{
"limits": "",
"message_id": "message.6",
"path": "",
"position": 6,
"raw": {
"hint_template": "You might need to increase \"max_locks_per_transaction\".",
"id": "message.6",
"primary_template": "out of shared memory",
"severity_source": "ERROR",
"sources": [
"src.path.6"
],
"sqlstate": "53200"
},
"severity": "ERROR",
"sources": [
"src.path.6"
],
"templates": [
{
"kind": "primary",
"literal": "out of shared memory",
"position": 0,
"role": "",
"template": "out of shared memory"
},
{
"kind": "hint",
"literal": "You might need to increase \"max_locks_per_transaction\".",
"position": 1,
"role": "",
"template": "You might need to increase \"max_locks_per_transaction\"."
}
]
}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#L409"
}sources · src.path.0
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/pg_stat_statements/pg_stat_statements.c",
"position": 1,
"sha256": "5a732a7c5b124ba98f2e3939c2458b85757c49fdb7846276f6b96ceeb833e74b",
"source_id": "src.path.0",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pg_stat_statements/pg_stat_statements.c#L2346"
}sources · src.path.1
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/pg_walinspect/pg_walinspect.c",
"position": 2,
"sha256": "bd6adbfd21eb9287d9e2d18ca19028d75ad00f8543256c80071e0c357e703b9e",
"source_id": "src.path.1",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pg_walinspect/pg_walinspect.c#L121"
}sources · src.path.2
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/access/transam/twophase.c",
"position": 3,
"sha256": "52e4fc67a5c3555ca8c1f75f5e12306a93bae17ecb49fd6ef6c5136ddc0db96a",
"source_id": "src.path.2",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/transam/twophase.c#L1417"
}sources · src.path.3
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/mmgr/aset.c",
"position": 4,
"sha256": "ae1f091f78f913a224c3659abc0e7798603dff348fe21d23d44a8789c5fd3098",
"source_id": "src.path.3",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/mmgr/aset.c#L444"
}sources · src.path.4
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/mmgr/mcxt.c",
"position": 5,
"sha256": "19824d40a1b2b7f533fd7863c91117a33c0879bf776fc7fbe495f603e032344e",
"source_id": "src.path.4",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/mmgr/mcxt.c#L1157"
}sources · src.path.5
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/storage/ipc/shmem.c",
"position": 6,
"sha256": "27ee1cdd55975fbe57607d2236d117ab50d8135cca5622af6f03ccd768bb5680",
"source_id": "src.path.5",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/ipc/shmem.c#L151"
}sources · src.path.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/storage/lmgr/lock.c",
"position": 7,
"sha256": "e7f43560bf6a8417ff46991238084b6edeb44a995b87670ed1f7fa6f1515276b",
"source_id": "src.path.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/lmgr/lock.c#L2957"
}sources · src.calls.REL_18_6
{
"commit": "",
"docs_url": "",
"kind": "local_artifact",
"location": "",
"path": "raw/calls/REL_18_6.jsonl",
"position": 8,
"sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
"source_id": "src.calls.REL_18_6",
"tag": "REL_18_6",
"url": ""
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:f8286524248252e5312932e05cf94e94a5fb48bd72cab200e116824f095ed062
正文语言: zh-Hans · english-manuals:f8286524248252e5312932e05cf94e94a5fb48bd72cab200e116824f095ed062