代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/rsyslog 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From deefc958c388995fac99c581284fb86eb9653ece Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Thu, 23 Mar 2023 10:58:32 +0100
Subject: [PATCH] [backport] core/bugfix: using $uuid msg prop can deadlock
rsyslog on shutdown
This problem can occur if a large number of threads is used and rsyslog
cannot shut down all queues etc within the regular time interval. In this
case, it cancels some threads. That can leave the mutex guarding libuuid
calls locked and thus prevents other, not yet cancelled threads from
progressing. Assuming pthread_mutex_lock() is not a cancellation point,
this will case these other threads to hang forever and thus create a
deadlock situation.
closes https://github.com/rsyslog/rsyslog/issues/5104
---
Conflict:NA
Type:bugfix
Reference:https://github.com/rsyslog/rsyslog/commit/82687e14fbf3d854e8cc954efb9fb0efa69a28d2
---
---
runtime/msg.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/runtime/msg.c b/runtime/msg.c
index 73b7cec80..a3ddb8684 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -7,7 +7,7 @@
* of the "old" message code without any modifications. However, it
* helps to have things at the right place one we go to the meat of it.
*
- * Copyright 2007-2022 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2007-2023 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of the rsyslog runtime library.
*
@@ -1618,13 +1618,22 @@ msgSetPRI(smsg_t *const __restrict__ pMsg, syslog_pri_t pri)
/* note: libuuid seems not to be thread-safe, so we need
* to get some safeguards in place.
*/
+static pthread_mutex_t mutUUID = PTHREAD_MUTEX_INITIALIZER;
+
+static void call_uuid_generate(uuid_t uuid)
+{
+ pthread_mutex_lock(&mutUUID);
+ pthread_cleanup_push(mutexCancelCleanup, &mutUUID);
+ uuid_generate(uuid);
+ pthread_cleanup_pop(1);
+}
+
static void msgSetUUID(smsg_t * const pM)
{
size_t lenRes = sizeof(uuid_t) * 2 + 1;
char hex_char [] = "0123456789ABCDEF";
unsigned int byte_nbr;
uuid_t uuid;
- static pthread_mutex_t mutUUID = PTHREAD_MUTEX_INITIALIZER;
dbgprintf("[MsgSetUUID] START, lenRes %llu\n", (long long unsigned) lenRes);
assert(pM != NULL);
@@ -1632,9 +1641,7 @@ static void msgSetUUID(smsg_t * const pM)
if((pM->pszUUID = (uchar*) malloc(lenRes)) == NULL) {
pM->pszUUID = (uchar *)"";
} else {
- pthread_mutex_lock(&mutUUID);
- uuid_generate(uuid);
- pthread_mutex_unlock(&mutUUID);
+ call_uuid_generate(uuid);
for (byte_nbr = 0; byte_nbr < sizeof (uuid_t); byte_nbr++) {
pM->pszUUID[byte_nbr * 2 + 0] = hex_char[uuid [byte_nbr] >> 4];
pM->pszUUID[byte_nbr * 2 + 1] = hex_char[uuid [byte_nbr] & 15];
@@ -5352,5 +5359,3 @@ BEGINObjClassInit(msg, 1, OBJ_IS_CORE_MODULE)
INIT_ATOMIC_HELPER_MUT(mutTrimCtr);
# endif
ENDObjClassInit(msg)
-/* vim:set ai:
- */
--
2.12.3
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。