Skip to content

Commit

Permalink
tcp net subsystem: handle data race gracefully
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
rgerhards committed Oct 2, 2023
1 parent e7404b2 commit b73ccfb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/nsdsel_ptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b73ccfb

Please sign in to comment.