rsyslog/backport-tcp-net-subsystem-handle-data-race-gracefully.patch
Qiumiao Zhang b83e0b1c2a backport patches from upstream
Signed-off-by: Qiumiao Zhang <zhangqiumiao1@huawei.com>
2024-03-21 03:38:16 +00:00

37 lines
1.4 KiB
Diff

From b73ccfb4be883862f1405bd40deca5a111f0c0a2 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Mon, 2 Oct 2023 09:32:07 +0200
Subject: [PATCH] tcp net subsystem: handle data race gracefully
It may happen that a socket file descriptor has been closed either
while setting up poll() et al or while being inside the system call.
This was previously treated as error and caused abort in debug
builds. However, it was essentially ignored in production builds.
This has now been fixed and now is always gracefully ignored. This
most importantly fixes some flakes in CI runs (which were caused
by this situation).
Reference:https://github.com/rsyslog/rsyslog/commit/b73ccfb4be883862f1405bd40deca5a111f0c0a2
Conflict:NA
---
runtime/nsdsel_ptcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/nsdsel_ptcp.c b/runtime/nsdsel_ptcp.c
index 2558f09df6..d77c729809 100644
--- a/runtime/nsdsel_ptcp.c
+++ b/runtime/nsdsel_ptcp.c
@@ -159,9 +159,9 @@ IsReady(nsdsel_t *const pNsdsel, nsd_t *const pNsd, const nsdsel_waitOp_t waitOp
const short revent = pThis->fds[idx].revents;
if (revent & POLLNVAL) {
- DBGPRINTF("ndssel_ptcp: revent & POLLNVAL is TRUE, something is wrong, revent = %d", revent);
+ DBGPRINTF("ndssel_ptcp: revent & POLLNVAL is TRUE, we had a race, ignoring, revent = %d", revent);
+ *pbIsReady = 0;
}
- assert(!(revent & POLLNVAL));
switch(waitOp) {
case NSDSEL_RD:
*pbIsReady = revent & POLLIN;