From 43cee6f9977d1690fe8c3613740af7286985eba9 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Mon, 19 Apr 2021 14:04:53 -0400 Subject: [PATCH] Fix: sessiond: trigger with condition not requiring event notifier cannot be listed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Observed issue ============== The lttng-sessiond process aborts when an lttng error query is performed against a trigger that uses a condition other than "event-match". Cause ===== The trigger's condition is a LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE which does not have a "domain type". This results in the call to `abort()` in `event_notifier_error_accounting_get_count` of the default case. Solution ======== Check if the trigger "needs" or at least "depends" on tracer notifier. Known drawbacks ========= None Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I3d5f09617f95315060a611b464d1df95cb80c5bd --- src/bin/lttng-sessiond/event-notifier-error-accounting.c | 1 + src/bin/lttng-sessiond/trigger-error-query.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.c b/src/bin/lttng-sessiond/event-notifier-error-accounting.c index 02c99b96b..61ba6981e 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.c +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.c @@ -1042,6 +1042,7 @@ event_notifier_error_accounting_get_count( return event_notifier_error_accounting_ust_get_count(trigger, count); #else + *count = 0; return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; #endif /* HAVE_LIBLTTNG_UST_CTL */ default: diff --git a/src/bin/lttng-sessiond/trigger-error-query.c b/src/bin/lttng-sessiond/trigger-error-query.c index ff8c9ca05..54aeb4149 100644 --- a/src/bin/lttng-sessiond/trigger-error-query.c +++ b/src/bin/lttng-sessiond/trigger-error-query.c @@ -29,6 +29,12 @@ enum lttng_trigger_status lttng_trigger_add_error_results( &trigger_owner); assert(status == LTTNG_TRIGGER_STATUS_OK); + /* Only add discarded tracer messages count for applicable triggers. */ + if (!lttng_trigger_needs_tracer_notifier(trigger)) { + status = LTTNG_TRIGGER_STATUS_OK; + goto end; + } + error_accounting_status = event_notifier_error_accounting_get_count( trigger, &discarded_tracer_messages_count); if (error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) { -- 2.34.1