From a17b133bc868e046f285146e26a5bbe2a569b892 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 12 Mar 2021 14:54:52 -0500 Subject: [PATCH] Fix: sessiond: off-by-one poll check when draining an event notifier MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When an event source is removed (on the death of an application), the notification thread "drains" any remaining notifications from the event notifier pipe. In doing so, it creates a new poll set containing the event source to check if messages are left in the event notification pipe. The invocation of `LTTNG_POLL_GETEV(&events, 1)` means to check the events pending for the first (and only) fd in the poll set. This check is off by one since `0` should be used. For some reason, this worked everywhere except when using a 32-bit userland on a 64-bit kernel (on x86_64). Signed-off-by: Jérémie Galarneau Change-Id: I6f274fdd7c80d5676fd48ae20a14adb3cc010142 --- src/bin/lttng-sessiond/notification-thread-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 6bd799279..747902612 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -2017,7 +2017,7 @@ int drain_event_notifier_notification_pipe( * the pipe is closed but empty. */ ret = lttng_poll_wait_interruptible(&events, 0); - if (ret == 0 || (LTTNG_POLL_GETEV(&events, 1) & LPOLLIN) == 0) { + if (ret == 0 || (LTTNG_POLL_GETEV(&events, 0) & LPOLLIN) == 0) { /* No more notification to be read on this pipe. */ ret = 0; goto end; -- 2.34.1