src.ctf.lttng-live: make component class handle interruptions
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 4 Nov 2019 17:07:22 +0000 (12:07 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 15 Nov 2019 17:28:24 +0000 (12:28 -0500)
commitf79c2d7a3575db7cd07f502b39e1db76619b70a6
tree378831db64b7054ce96a722a073b8a6ab2e50e35
parent5b95946946be336c684e1dc2d05bd7b06674eed1
src.ctf.lttng-live: make component class handle interruptions

Currently, if a `src.ctf.lttng-live` component is interrupted by a
signal during a I/O syscall, it will return an _ERROR status downstream.
This is wrong for two reasons:
  1. Some signals are not problematic (e.g. SIGUSR1) so we want to
     continue as normal, and
  2. we want to return an _AGAIN status when we receive a SIGINT
     signal.

With this commit, when getting interrupted during a `recv()` or `send()`
call, we check if the graph is now in the interrupted state and return
the _AGAIN status if this case.
This commit changes the semantic of the lttng_live_{recv, send}
functions to make them return a status (_OK, _INTERRUPTED, or _ERROR).
The _OK status is only returned if the entire message was received or
sent. This allows us to remove many checks of the length of received or
sent data.

With this commit, once a live iterator is interrupted by SIGINT and
returns _AGAIN it's not in a state that can be recovered if the graph was
to be run again. Further work is needed to make this component class
restartable.

So to prevent user of the graph to call the _NEXT method after an
interruption, we mark the live iterator as interrupted (with the
`was_interrupted` boolean field) and return an error if it's the case.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I36cba1c3456250099ddfa9a2b15646c3e4f61e94
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2324
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/plugins/ctf/lttng-live/lttng-live.c
src/plugins/ctf/lttng-live/lttng-live.h
src/plugins/ctf/lttng-live/metadata.c
src/plugins/ctf/lttng-live/viewer-connection.c
src/plugins/ctf/lttng-live/viewer-connection.h
This page took 0.025269 seconds and 4 git commands to generate.