Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: bt2: clear Python error indicator in trace and trace class destr…
…uction listeners When an exception is raised in a trace or trace class destruction listener, we hit this assert: LIB/TRACE-CLASS destroy_trace_class@trace-class.c:110 Babeltrace 2 library postcondition not satisfied; error is: LIB/TRACE-CLASS destroy_trace_class@trace-class.c:110 Destruction listener kept a reference to the trace class being destroyed: tc-addr=0x6080000027a0, tc-is-frozen=0, tc-stream-class-count=0, tc-assigns-auto-sc-id=1 LIB/TRACE-CLASS destroy_trace_class@trace-class.c:110 Aborting... The problem is that we don't clear the error indicator on the error code path after running the user code. The error indicator (the exception) keeps a reference to the Python stack, which has a reference to the trace or trace class Python object. This, in turn has kept a reference to the Babeltrace trace or trace class object. The solution is to clear the error indicator, which releases all of this. Another problem is that calling loge_exception_append_cause appends an error cause, even though it's not valid to leave an error cause when exiting those functions, as they don't return an error status. That error cause is left dangling and might wrongfully appear on an eventual future error stack. To fix it, use logw_exception instead of loge_exception_append_cause. This matches what we do in component_class_finalize and component_class_message_iterator_finalize, which are very similar situations. Change-Id: Ib756461610366badb6384577ad7cdf6468944be9 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/2224 Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
- Loading branch information