Fix: evaluate trigger condition on registration
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 23 Nov 2017 02:16:38 +0000 (21:16 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 26 Nov 2017 12:06:56 +0000 (13:06 +0100)
commit2ae99f0b1ce4b1ae352a7bf179b1f040111afd46
tree19be2d7a53576bc14434e9606db237417590d84f
parentefcbc78c435a4ce7689ab6920b35e78372aa0194
Fix: evaluate trigger condition on registration

Since there is nothing preventing clients from subscribing to a
condition before the corresponding trigger is registered, we have
to evaluate this new condition right away.

The current implementation is waiting for the next "evaluation" of
conditions (e.g. on reception of a channel sample) to evaluate this
newly registered trigger conditions, but this is broken.

The reason it is broken is that waiting for the next sample
does not allow us to properly handle transitions for edge-triggered
conditions.

Consider this example: when we handle a new channel sample, we
evaluate each conditions twice: once with the previous state, and
again with the newest state. We then use those two results to
determine whether a state change happened: a condition was false and
became true. If a state change happened, we have to notify clients.

Now, if a client subscribes to a given notification and registers
a trigger *after* that subscription, we have to make sure the
condition is evaluated at this point while considering only the
current state. Otherwise, the next evaluation cycle may only see
that the evaluations remain the same (true for samples n-1 and n) and
the client will never know that the condition has been met.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/notification-thread-events.c
src/bin/lttng-sessiond/notification-thread.h
This page took 0.025135 seconds and 4 git commands to generate.