Fix: sessiond: trigger with condition not requiring event notifier cannot be listed
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 19 Apr 2021 18:04:53 +0000 (14:04 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Apr 2021 05:23:02 +0000 (01:23 -0400)
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 <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3d5f09617f95315060a611b464d1df95cb80c5bd

src/bin/lttng-sessiond/event-notifier-error-accounting.c
src/bin/lttng-sessiond/trigger-error-query.c

index 02c99b96bcf0669b765884cac41ec04958842de3..61ba6981e7806426a50cb5d287c4cdc4a9d6f208 100644 (file)
@@ -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:
index ff8c9ca05b9ef08a7a8fca2581f82f66f3b4ff09..54aeb414959ae9d12cba8e47bf5ed955e4cb797a 100644 (file)
@@ -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) {
This page took 0.026064 seconds and 4 git commands to generate.