From c9baf1bd5bd3cfa6b6ad22ba2e8dabeefda420ed Mon Sep 17 00:00:00 2001 From: laishenghao Date: Sat, 18 Feb 2023 09:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8F=82=E6=95=B0max=5Fproce?= =?UTF-8?q?sses=3D200000+=E5=BC=80=E5=90=AF=E7=BA=BF=E7=A8=8B=E6=B1=A0?= =?UTF-8?q?=EF=BC=8C=E5=90=AF=E5=8A=A8=E6=95=B0=E6=8D=AE=E5=BA=93coredump?= =?UTF-8?q?=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/backend/utils/error/elog.cpp | 2 +- src/gausskernel/process/postmaster/postmaster.cpp | 4 ++++ src/gausskernel/process/threadpool/threadpool_group.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/common/backend/utils/error/elog.cpp b/src/common/backend/utils/error/elog.cpp index 989e07171..8bc2a0112 100644 --- a/src/common/backend/utils/error/elog.cpp +++ b/src/common/backend/utils/error/elog.cpp @@ -1644,7 +1644,7 @@ void EmitErrorReport(void) if (can_skip && need_skip_by_retry) { /* skip sending messsage to front, do noting for now */ } else { - if (u_sess->proc_cxt.MyProcPort) { + if (u_sess->proc_cxt.MyProcPort && u_sess->proc_cxt.MyProcPort->protocol_config) { u_sess->proc_cxt.MyProcPort->protocol_config->fn_send_message(edata); } } diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index fa92f25c7..013c11607 100644 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -8442,6 +8442,10 @@ void PortInitialize(Port* port, knl_thread_arg* arg) /* read variables from arg */ read_backend_variables(arg->save_para, port); + if (port->protocol_config == nullptr) { + port->protocol_config = &default_protocol_config; + } + /* fix thread pool workers and some background threads creation_time * in pg_os_threads view not correct issue. */ diff --git a/src/gausskernel/process/threadpool/threadpool_group.cpp b/src/gausskernel/process/threadpool/threadpool_group.cpp index f45371f86..639ff88a3 100644 --- a/src/gausskernel/process/threadpool/threadpool_group.cpp +++ b/src/gausskernel/process/threadpool/threadpool_group.cpp @@ -55,6 +55,7 @@ status == STATE_STREAM_WAIT_CONNECT_NODES || \ status == STATE_STREAM_WAIT_PRODUCER_READY || \ status == STATE_WAIT_XACTSYNC) +#define WAIT_READY_MAX_TIMES 10000 ThreadPoolGroup::ThreadPoolGroup(int maxWorkerNum, int expectWorkerNum, int maxStreamNum, int groupId, int numaId, int cpuNum, int* cpuArr, bool enableBindCpuNuma) @@ -192,12 +193,16 @@ void ThreadPoolGroup::ReleaseWorkerSlot(int i) void ThreadPoolGroup::WaitReady() { - while (true) { + int cnt = 0; + while (cnt++ < WAIT_READY_MAX_TIMES) { if (m_listenerNum == 1) { break; } pg_usleep(500); } + if (m_listenerNum != 1) { + ereport(ERROR, (errmsg_internal("ThreadPoolGroup::WaitReady() timeout, m_listenerNum= %d", m_listenerNum))); + } } float4 ThreadPoolGroup::GetSessionPerThread()