From: Jonathan Rajotte Date: Mon, 6 Jan 2020 16:46:21 +0000 (-0500) Subject: Fix: skip start trace for app that are already started. X-Git-Tag: v2.12.0-rc1~83 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=b0a1c7415575acbf66a625c338ea9cf6fa9df27c Fix: skip start trace for app that are already started. When using trackers, call to ust_app_global_update results in a call to ust_app_start_trace even if the ust app trace was already enabled. This resulted in error message from the app (-1024) complaining that the tracing was already active on the app side. Error: Error starting tracing for app pid: 329376 (ret: -1024) ok 211 - Track command with opts: 0 -u --vpid 329376 A solution to this is to keep the enabled state inside the ua_sess and skip the start trace if already enabled. Signed-off-by: Jonathan Rajotte Change-Id: Ie4198245627e9f0426948489bc9ce24d8c813b08 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 823de9478..63bf4648b 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -4347,6 +4347,11 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) goto end; } + if (ua_sess->enabled) { + pthread_mutex_unlock(&ua_sess->lock); + goto end; + } + /* Upon restart, we skip the setup, already done */ if (ua_sess->started) { goto skip_setup; @@ -4387,6 +4392,7 @@ skip_setup: /* Indicate that the session has been started once */ ua_sess->started = 1; + ua_sess->enabled = 1; pthread_mutex_unlock(&ua_sess->lock); @@ -4476,6 +4482,7 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app) } health_code_update(); + ua_sess->enabled = 0; /* Quiescent wait after stopping trace */ pthread_mutex_lock(&app->sock_lock);