【标题描述】:
并发改config文件导致coredump
【测试类型:并发】【测试版本:3.0.0】
【操作系统和硬件信息】(查询命令: cat /etc/system-release, uname -a):
CentOS Linux release 7.9.2009 (Core)
x86_64 GNU/Linux
【测试环境】(单机/1主x备x级联备):
单机
【被测功能】:
多线程并发使用ALTER SYSTEM SET命令修改postgresql.conf文件
【数据库版本】(查询命令: gaussdb –V):
openGauss 3.0.0 build 6c589864
【预置条件】:
启动opengauss
【操作步骤】(请填写详细的操作步骤):
【预期输出】:
每个testcase修改参数后,postgresql.conf文件中所有修改了的参数结果一致。以以上两个testcase为例,archive_mode应为off, archive_timeout应为0.
【实际输出】:
数据库运行出错,coredump
【原因分析】:
关于修改conf文件有两种race condition,一种是thread, opengauss不同thread会同时修改conf文件;另一种是process,gs_guc程序和opengauss主程序会同时修改conf文件。
保留原先的flock锁作为process锁,然后在这基础上加上opengauss全局锁lwlock作为thread锁,每次更改conf文件都需要拿到这两把锁,release的时候需要先release process锁,再release thread锁,不然会有race condition
【日志信息】(请附上日志文件、截图、coredump信息):
#0 write_guc_file (
path=path@entry=0x7f21f6f6c020 "/data/msun/openGauss-server/src/test/regress/tmp_check/datanode1/postgresql.conf.bak_bak", lines=lines@entry=0x0) at guc.cpp:12027
#1 0x000055cd7c38e4a9 in WriteAlterSystemSetGucFile (
ConfFileName=ConfFileName@entry=0x7f21f6f6c020 "/data/msun/openGauss-server/src/test/regress/tmp_check/datanode1/postgresql.conf.bak_bak", opt_lines=0x0, filelock=filelock@entry=0x7f21f6f6b780)
at guc.cpp:8507
#2 0x000055cd7c38ea14 in AlterSystemSetConfigFile (altersysstmt=altersysstmt@entry=0x7f21fb7f1890)
at guc.cpp:8596
#3 0x000055cd7c8d04fd in standard_ProcessUtility (parse_tree=parse_tree@entry=0x7f21fb7f1890,
query_string=query_string@entry=0x7f21f744d790 "alter system set autovacuum to off",
params=params@entry=0x0, is_top_level=,
dest=dest@entry=0x55cd8258bca0 , sent_to_remote=,
completion_tag=0x7f21f6f6f120 "", isCTAS=false) at utility.cpp:5557
#4 0x00007f22d7f590a9 in gsaudit_ProcessUtility_hook (parsetree=0x7f21fb7f1890,
queryString=0x7f21f744d790 "alter system set autovacuum to off", params=0x0,
isTopLevel=, dest=0x55cd8258bca0 , sentToRemote=,
completionTag=0x7f21f6f6f120 "", isCTAS=false) at gs_policy_plugin.cpp:1062
#5 0x000055cd7c8de63c in pgaudit_ProcessUtility (parsetree=0x7f21fb7f1890,
queryString=0x7f21f744d790 "alter system set autovacuum to off", params=,
isTopLevel=, dest=, sentToRemote=,
completionTag=0x7f21f6f6f120 "", isCTAS=false) at auditfuncs.cpp:1198
#6 0x000055cd7c8c2265 in PortalRunUtility (portal=portal@entry=0x7f224e0bc040,
utilityStmt=utilityStmt@entry=0x7f21fb7f1890, isTopLevel=isTopLevel@entry=true,
dest=dest@entry=0x55cd8258bca0 ,
completionTag=completionTag@entry=0x7f21f6f6f120 "") at pquery.cpp:1758
#7 0x000055cd7c8c33c4 in PortalRunMulti (portal=portal@entry=0x7f224e0bc040,
isTopLevel=isTopLevel@entry=true, dest=0x55cd8258bca0 , dest@entry=0x7f223a1c64a0,
altdest=0x55cd8258bca0 , altdest@entry=0x7f223a1c64a0,
completionTag=completionTag@entry=0x7f21f6f6f120 "") at pquery.cpp:1937
#8 0x000055cd7c8c5f48 in PortalRun (portal=portal@entry=0x7f224e0bc040,
count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true,
dest=dest@entry=0x7f223a1c64a0, altdest=altdest@entry=0x7f223a1c64a0,
completionTag=completionTag@entry=0x7f21f6f6f120 "") at pquery.cpp:1183
#9 0x000055cd7be74890 in exec_execute_message (portal_name=portal_name@entry=0x7f223a1c6040 "",
max_rows=9223372036854775807, max_rows@entry=0) at postgres.cpp:4997
#10 0x000055cd7c8c045a in PostgresMain (argc=, argv=argv@entry=0x7f2244af1780,
dbname=, username=) at postgres.cpp:8784
#11 0x000055cd7c832c6b in BackendRun (port=port@entry=0x7f21f6f6f7b0) at postmaster.cpp:7746
#12 0x000055cd7c8508e8 in GaussDbThreadMain<(knl_thread_role)2> (arg=0x7f226aadbf98)
at postmaster.cpp:11629
#13 0x000055cd7c832cc5 in InternalThreadFunc (args=) at postmaster.cpp:12186
---Type to continue, or q to quit---
#14 0x00007f22e24a1ea5 in start_thread () from /lib64/libpthread.so.0
#15 0x00007f22e21cab0d in clone () from /lib64/libc.so.6
Hey @wenkeyang_abab, Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss-bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at Here to find the details.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论