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()