Fix: sync event enablers before choosing header type
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Oct 2018 19:48:16 +0000 (15:48 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Oct 2018 21:06:12 +0000 (17:06 -0400)
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 <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-events.c

index 255c4b953f9055141e72fae3449c37da5e56cb6b..7aa288c75210d1da75d84cfef08f82cdbcc292bf 100644 (file)
@@ -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;
This page took 0.026097 seconds and 4 git commands to generate.