Re: [PATCH] eal/linux: harden uevent recv error handling

Stephen Hemminger <[email protected]>
Newsgroups org.dpdk.dev
Message-ID <[email protected]>
On Thu, 13 Aug 2026 16:16:56 -0400
Randy Tice <[email protected]> wrote:

> The Linux uevent handler is harded for non-blocking receive behavior
> 
> Signed-off-by: Randy Tice <[email protected]>
> ---

Good idea, but the code needs to unregister the uevent fd on error.
Also, fix spelling error, decode error message, and handle odd
case where recv() got interrupted.

Something like (untested):

diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ec408649d0..1985d5e122 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -241,11 +241,17 @@ dev_uev_handler(__rte_unused void *param)
 
 	ret = recv(rte_intr_fd_get(intr_handle), buf, EAL_UEV_MSG_LEN,
 		   MSG_DONTWAIT);
-	if (ret < 0 && errno == EAGAIN)
-		return;
-	else if (ret <= 0) {
-		/* connection is closed or broken, can not up again. */
-		EAL_LOG(ERR, "uevent socket connection is broken.");
+	if (ret <= 0) {
+		if (ret < 0) {
+			/* non blocking or interrupted */
+			if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
+				return;
+			EAL_ERR(ERR, "unexpected error on uevent: %s",
+				strerror(errno));
+		} else {
+			/* zero length recv is end of file */
+			EAL_LOG(ERR, "uevent socket connection is broken.");
+		}
 		rte_eal_alarm_set(1, dev_delayed_unregister, NULL);
 		return;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.