From: Mathieu Desnoyers Date: Wed, 17 Oct 2018 19:48:16 +0000 (-0400) Subject: Fix: sync event enablers before choosing header type X-Git-Tag: v2.12.0-rc1~69 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3ff7660f2ce6362de87a48bc45c9a98b9c785472;p=lttng-ust.git Fix: sync event enablers before choosing header type On session start, we should allocate the event IDs before figuring out the number of events per channel and select the proper header type. Without this, the number of events is always perceived to be 0, which selects the "compact" header type. With UST, the order of those two actions is not the only one affecting the chosen header type: UST can receive the session start command before all probe provider library constructors have completed running, therefore finding less events than eventually enabled within the process. Moreover, with per-uid buffers, many processes end up registering events into shared buffers. Therefore, the guess based on number of events from the first process to use the buffer is incorrect. Considering that we typically have applications with more than 30 events, we will modify the session daemon so it selects the "large" header type independently of the number of events. We still want to swap the order of the enablers sync vs header type getter because we may revisit how session enabling is done in a process wrt constructor completion, which may allow us to do a more precise choice for per-pid buffers in the future. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index 255c4b95..7aa288c7 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -415,6 +415,9 @@ int lttng_session_enable(struct lttng_session *session) /* Set transient enabler state to "enabled" */ session->tstate = 1; + /* We need to sync enablers with session before activation. */ + lttng_session_sync_enablers(session); + /* * Snapshot the number of events per channel to know the type of header * we need to use. @@ -458,9 +461,6 @@ int lttng_session_enable(struct lttng_session *session) } } - /* We need to sync enablers with session before activation. */ - lttng_session_sync_enablers(session); - /* Set atomically the state to "active" */ CMM_ACCESS_ONCE(session->active) = 1; CMM_ACCESS_ONCE(session->been_active) = 1;