首批通过分布式安全可靠测评,为关键业务系统打造
使用 ODC 调试带有 CursorForLoop 语句的存储过程时,OBServer 进程可能 core dump
更新时间:2026-06-04 09:56
问题现象
在 ODC 中调试如下含有 CursorForLoop 的存储过程时,可能出现 OBServer 进程 core dump。
-- reboot 数据库后初始化数据:
create table t(col1 int, col2 int, col3 int, col4 int, col5 int, col6 int, col7 int, col8 int, col9 int, col10 int);
insert into t values(1,2,3,4,5,6,7,8,9,10);
select * from t;
commit;
-- ODC 连接到数据库调试如下匿名块可以复现 core 掉问题
DECLARE
i NUMBER;
BEGIN
for idx in (select * from t) loop
dbms_output.put_line(1);
for idx in (select * from t) loop
dbms_output.put_line(2);
for idx in (select * from t) loop
dbms_output.put_line(3);
end loop;
end loop;
end loop;
for idx in (select * from t) loop
dbms_output.put_line(4);
end loop;
END;
for idx in (select * from t) loop ... end 为 CursorForLoop,调试此处时可能出现 core dump。
关键诊断信息
触发条件
使用 ODC 调试带有 CursorForLoop 语句的存储过程。
问题原因
实现 CursorForLoop 语句时,需要使用一个变量来保存当前的 index,在 OceanBase 数据库 V4.x 之前版本,该变量保存在栈上,循环结束后该变量的栈内存会被释放。而调试器读取全部变量时,如果该栈内存已被复用,调试器可能读到脏数据导致 core dump。
问题风险及影响
偶现问题,可能影响用户调试存储过程。
影响版本
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)及之后版本、V3.2.4 GA(oceanbase-3.2.4.0-100000072022102819)及之后版本。
解决方法及规避方式
升级到问题已修复版本,目前已修复的版本包括 OceanBase 数据库 V2.2.77 BP19(oceanbase-2.2.77-119000122024060513)及之后版本、V3.2.3 BP8 Hotfix4(oceanbase-3.2.3.3-108040052023060909)版本、V3.2.3 BP8 Hotfix5(oceanbase-3.2.3.3-108050012023070409)版本、V3.2.3 BP8 Hotfix6(oceanbase-3.2.3.3-108060012023102510)版本、V3.2.3 BP9(oceanbase-3.2.3.3-109000182023071410)及之后版本、V3.2.4 BP4(oceanbase-3.2.4.4-104000052023062021)及之后版本。
禁止对包含
CursorForLoop的存储过程进行调试。