首批通过分布式安全可靠测评,为关键业务系统打造
PL to_hex 使用全局 buffer 导致 core 问题
更新时间:2026-06-04 09:56
问题现象
并发调试场景下,OBServer core 掉,堆栈如下。
#7 oceanbase::common::ObSqlString::reset (this=this@entry=0xf6dc600 <oceanbase::pl::debugger::s>) at deps/oblib/src/lib/string/ob_sql_string.cpp:35
#8 0x0000000003eeea78 in oceanbase::pl::debugger::to_hex (addr=65992896) at src/pl/debug/ob_pl_dwarf_helper.cpp:169
#9 0x0000000003eec670 in oceanbase::pl::debugger::ObPLDebugger::run (this=this@entry=0x7f16288384e0) at src/pl/debug/ob_pl_debugger.cpp:364
#10 0x0000000003eecf72 in oceanbase::pl::debugger::ObPLDebugger::debug_thread (data=0x7f16288384e0) at src/pl/debug/ob_pl_debugger.cpp:263
#11 0x00007f5240ac3ead in clone () from /lib64/libc.so.6
关键诊断信息
触发条件
PL 并发调试。
问题原因
debugger 模块打印地址的函数 to_hex 使用了一个全局的 buffer 来缓存 int64 转 hex 的值。在并发的场景下,这段内存会被随机写,导致读取和释放的时候可能访问到非法内存。
问题的风险及影响
在并发调试时 OBServer 可能 core 掉。
影响租户
影响 OceanBase 数据库中的 Oracle 租户,对于 SYS 租户和 MySQL 租户无影响。
影响的版本
OceanBase 数据库企业版 V2.2.77 GA(oceanbase-2.2.77-20210508211731)及之后版本、V3.1.2 GA(oceanbase-3.1.2-20210618150922)及之后版本、V3.2.3 GA(oceanbase-3.2.3.0-20220418212020)及之后版本。
解决方法及规避方式
解决方法:
升级至问题已修复版本。目前已修复的版本包括 OceanBase 数据库企业版 V2.2.77 BP14(oceanbase-2.2.77-114000072022120410)及之后版本、V3.1.2 BP10 Hotfix3(oceanbase-3.1.2-110030012022112109)及之后版本、V3.1.2 BP10 Hotfix4(oceanbase-3.1.2-110040012022120115)及之后版本、V3.1.2 BP10 Hotfix5(oceanbase-3.1.2-110050022022120810)及之后版本、V3.1.2 BP11(oceanbase-3.1.2-111000052023010412)及之后版本、V3.2.3 BP5(oceanbase-3.2.3.2-105000062022090916)及之后版本。
规避方式:
尽量在一个 OBServer 上开启多个调试请求。