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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 5 Jun 2019 17:47:34 +0000 (13:47 -0400)
commit8cc56726828daf6e193dc131435948d2c9a2cb4e
tree7e646feeb1efa174f8a51d035999520fab1220a8
parentcd6128ca5412c3b9cb40afe2580008329f612930
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.025161 seconds and 4 git commands to generate.