lib: Make graph listeners return an error status
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 16 May 2019 16:10:18 +0000 (12:10 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 13 Jun 2019 21:24:21 +0000 (17:24 -0400)
commite18f3e2be2164f29c7ab272b86ee25d6ed84f8b3
treef803d73a42e3dd1aa1ea1d7161059268308ccda2
parent28273afc792bd73fe50cadb49002abcdd6120e29
lib: Make graph listeners return an error status

Currently, if a graph listener fails for some reason (for example, an
uncaught exception in Python), no error is reported to the initial
caller, so it has no way to handle the failure properly.  If a listener
fails, we can't really trust that the execution will proceed as
intended, so it is likely that the caller wants to exit with an error
too.

All the listener typedefs are updated to return a new type,
bt_graph_listener_status.  If any listener fails, the graph is put in
"faulty" state and we return an error up the stack.

If a listener fails, the action is not rolled back.  This means that if
a port added listener fails, the port that was added is not removed.  If
a ports connected listener fails, the connection is not undone.

A few call sites needed to be updated.  An interesting one is in
cli/babeltrace.c.  Where we previously aborted, we can now return an
error and exit cleanly.

The Python bindings is another user of the listener API.  I have
modified the functions in native_bt_graph.i to keep the code building,
but the errors are currently not propagated from the Python callback.
This will be done in a subsequent patch.

Change-Id: I115773c405162f7b1c617cf4a8302b980315e14d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1316
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
bindings/python/bt2/bt2/native_bt_graph.i
cli/babeltrace.c
include/babeltrace/graph/component-internal.h
include/babeltrace/graph/graph-internal.h
include/babeltrace/graph/graph.h
lib/graph/component-filter.c
lib/graph/component-sink.c
lib/graph/component-source.c
lib/graph/component.c
lib/graph/graph.c
tests/lib/test_graph_topo.c
This page took 0.026346 seconds and 4 git commands to generate.