From 8608048197140ff72aa546d934da94fb73ae3c8d Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Thu, 24 Feb 2022 16:24:36 -0500 Subject: [PATCH] Fix: src.ctf.lttng-live: session closed before any metadata is received MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Issue ===== When stress-testing the LTTng-UST clear feature over an entire night I witnessed 6 instances of Babeltrace infinite loop. Using the GNU Debugger, Babeltrace was found to be endlessly issuing the `LTTNG_VIEWER_GET_NEW_STREAMS` command to the Relay daemon to which the Relay Daemon endlessly replied `LTTNG_VIEWER_NEW_STREAMS_HUP`. This is caused by the fact that the session was closed before we received any metadata and the lttng-live component class keeps trying to ask for new streams before requesting the metadata. Fix === If the session is marked as closed return a `_STATUS_END` to stop considering this session. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I9c18d03cef1b61d1c02b7d608720bf5750a348c4 Reviewed-on: https://review.lttng.org/c/babeltrace/+/6827 --- src/plugins/ctf/lttng-live/metadata.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/ctf/lttng-live/metadata.cpp b/src/plugins/ctf/lttng-live/metadata.cpp index d49ce76f..775396ee 100644 --- a/src/plugins/ctf/lttng-live/metadata.cpp +++ b/src/plugins/ctf/lttng-live/metadata.cpp @@ -114,7 +114,14 @@ enum lttng_live_iterator_status lttng_live_metadata_update(struct lttng_live_tra /* No metadata stream yet. */ if (!metadata) { - if (session->new_streams_needed) { + if (session->closed) { + /* + * The session is closed AND we never received any + * metadata this indicates that we will never receive + * any metadata. + */ + status = LTTNG_LIVE_ITERATOR_STATUS_END; + } else if (session->new_streams_needed) { status = LTTNG_LIVE_ITERATOR_STATUS_AGAIN; } else { session->new_streams_needed = true; -- 2.34.1