From: Jonathan Rajotte Date: Mon, 14 Feb 2022 16:23:28 +0000 (-0500) Subject: Fix: rotation: hang on destroy when using scheduled rotation based on timer X-Git-Tag: v2.12.9~17 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f98f5b9fd64d8e0cf3a7142af1b9148d4d003283;p=lttng-tools.git Fix: rotation: hang on destroy when using scheduled rotation based on timer Observed issue ============== The following scenario results in a hang for `lttng destroy`: lttng create test lttng enable-event -u -a lttng enable-rotation --timer 100000 lttng start lttng stop lttng start lttng destroy Cause ===== There is an imbalance in how many times we start the rotation timer. The rotation timer is only removed on `lttng destroy` or when disabling a time-based-rotation. On the other hand, the timer is "started" on `lttng start` and when enabling a time based rotation. The imbalance emerging from a start/stop/start sequence would prevent the teardown of the session object since each time the timer is started a reference to the session is held. Solution ======== Do not start the rotation schedule timer if it was already launched. Known drawbacks ========= None. Change-Id: Ic5b8938166358fe7629187bebdf02a09e90846c0 Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 1b0270e31..6f3dd7177 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2866,7 +2866,7 @@ int cmd_start_trace(struct ltt_session *session) */ session->rotated_after_last_stop = false; - if (session->rotate_timer_period) { + if (session->rotate_timer_period && !session->rotation_schedule_timer_enabled) { int int_ret = timer_session_rotation_schedule_timer_start( session, session->rotate_timer_period);