projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: fix periodical flush tests to stop app
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
ust-app.c
diff --git
a/src/bin/lttng-sessiond/ust-app.c
b/src/bin/lttng-sessiond/ust-app.c
index 830b5eafeeb3328737f66cb75c7f7ef9526fb2ae..7a34230689c3153b7a9cee0c912eb105d3dd92be 100644
(file)
--- a/
src/bin/lttng-sessiond/ust-app.c
+++ b/
src/bin/lttng-sessiond/ust-app.c
@@
-364,6
+364,7
@@
void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan,
/* Wipe context */
cds_lfht_for_each_entry(ua_chan->ctx->ht, &iter.iter, ua_ctx, node.node) {
/* Wipe context */
cds_lfht_for_each_entry(ua_chan->ctx->ht, &iter.iter, ua_ctx, node.node) {
+ cds_list_del(&ua_ctx->list);
ret = lttng_ht_del(ua_chan->ctx, &iter);
assert(!ret);
delete_ust_app_ctx(sock, ua_ctx);
ret = lttng_ht_del(ua_chan->ctx, &iter);
assert(!ret);
delete_ust_app_ctx(sock, ua_ctx);
@@
-825,6
+826,7
@@
struct ust_app_channel *alloc_ust_app_channel(char *name,
lttng_ht_node_init_str(&ua_chan->node, ua_chan->name);
CDS_INIT_LIST_HEAD(&ua_chan->streams.head);
lttng_ht_node_init_str(&ua_chan->node, ua_chan->name);
CDS_INIT_LIST_HEAD(&ua_chan->streams.head);
+ CDS_INIT_LIST_HEAD(&ua_chan->ctx_list);
/* Copy attributes */
if (attr) {
/* Copy attributes */
if (attr) {
@@
-916,6
+918,8
@@
struct ust_app_ctx *alloc_ust_app_ctx(struct lttng_ust_context *uctx)
goto error;
}
goto error;
}
+ CDS_INIT_LIST_HEAD(&ua_ctx->list);
+
if (uctx) {
memcpy(&ua_ctx->ctx, uctx, sizeof(ua_ctx->ctx));
}
if (uctx) {
memcpy(&ua_ctx->ctx, uctx, sizeof(ua_ctx->ctx));
}
@@
-1051,6
+1055,12
@@
int create_ust_channel_context(struct ust_app_channel *ua_chan,
ERR("UST app create channel context failed for app (pid: %d) "
"with ret %d", app->pid, ret);
} else {
ERR("UST app create channel context failed for app (pid: %d) "
"with ret %d", app->pid, ret);
} else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
DBG3("UST app disable event failed. Application is dead.");
}
goto error;
DBG3("UST app disable event failed. Application is dead.");
}
goto error;
@@
-1089,6
+1099,12
@@
int set_ust_event_filter(struct ust_app_event *ua_event,
ERR("UST app event %s filter failed for app (pid: %d) "
"with ret %d", ua_event->attr.name, app->pid, ret);
} else {
ERR("UST app event %s filter failed for app (pid: %d) "
"with ret %d", ua_event->attr.name, app->pid, ret);
} else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
DBG3("UST app filter event failed. Application is dead.");
}
goto error;
DBG3("UST app filter event failed. Application is dead.");
}
goto error;
@@
-1118,6
+1134,12
@@
static int disable_ust_event(struct ust_app *app,
"and session handle %d with ret %d",
ua_event->attr.name, app->pid, ua_sess->handle, ret);
} else {
"and session handle %d with ret %d",
ua_event->attr.name, app->pid, ua_sess->handle, ret);
} else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
DBG3("UST app disable event failed. Application is dead.");
}
goto error;
DBG3("UST app disable event failed. Application is dead.");
}
goto error;
@@
-1148,6
+1170,12
@@
static int disable_ust_channel(struct ust_app *app,
"and session handle %d with ret %d",
ua_chan->name, app->pid, ua_sess->handle, ret);
} else {
"and session handle %d with ret %d",
ua_chan->name, app->pid, ua_sess->handle, ret);
} else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
DBG3("UST app disable channel failed. Application is dead.");
}
goto error;
DBG3("UST app disable channel failed. Application is dead.");
}
goto error;
@@
-1178,6
+1206,12
@@
static int enable_ust_channel(struct ust_app *app,
"and session handle %d with ret %d",
ua_chan->name, app->pid, ua_sess->handle, ret);
} else {
"and session handle %d with ret %d",
ua_chan->name, app->pid, ua_sess->handle, ret);
} else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
DBG3("UST app enable channel failed. Application is dead.");
}
goto error;
DBG3("UST app enable channel failed. Application is dead.");
}
goto error;
@@
-1210,6
+1244,12
@@
static int enable_ust_event(struct ust_app *app,
"and session handle %d with ret %d",
ua_event->attr.name, app->pid, ua_sess->handle, ret);
} else {
"and session handle %d with ret %d",
ua_event->attr.name, app->pid, ua_sess->handle, ret);
} else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
DBG3("UST app enable event failed. Application is dead.");
}
goto error;
DBG3("UST app enable event failed. Application is dead.");
}
goto error;
@@
-1290,6
+1330,12
@@
int create_ust_event(struct ust_app *app, struct ust_app_session *ua_sess,
ERR("Error ustctl create event %s for app pid: %d with ret %d",
ua_event->attr.name, app->pid, ret);
} else {
ERR("Error ustctl create event %s for app pid: %d with ret %d",
ua_event->attr.name, app->pid, ret);
} else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
DBG3("UST app create event failed. Application is dead.");
}
goto error;
DBG3("UST app create event failed. Application is dead.");
}
goto error;
@@
-1395,7
+1441,7
@@
static void shadow_copy_channel(struct ust_app_channel *ua_chan,
ua_chan->enabled = uchan->enabled;
ua_chan->tracing_channel_id = uchan->id;
ua_chan->enabled = uchan->enabled;
ua_chan->tracing_channel_id = uchan->id;
- cds_l
fht_for_each_entry(uchan->ctx->ht, &iter.iter, uctx, node.node
) {
+ cds_l
ist_for_each_entry(uctx, &uchan->ctx_list, list
) {
ua_ctx = alloc_ust_app_ctx(&uctx->ctx);
if (ua_ctx == NULL) {
continue;
ua_ctx = alloc_ust_app_ctx(&uctx->ctx);
if (ua_ctx == NULL) {
continue;
@@
-1403,6
+1449,7
@@
static void shadow_copy_channel(struct ust_app_channel *ua_chan,
lttng_ht_node_init_ulong(&ua_ctx->node,
(unsigned long) ua_ctx->ctx.ctx);
lttng_ht_add_unique_ulong(ua_chan->ctx, &ua_ctx->node);
lttng_ht_node_init_ulong(&ua_ctx->node,
(unsigned long) ua_ctx->ctx.ctx);
lttng_ht_add_unique_ulong(ua_chan->ctx, &ua_ctx->node);
+ cds_list_add_tail(&ua_ctx->list, &ua_chan->ctx_list);
}
/* Copy all events from ltt ust channel to ust app channel */
}
/* Copy all events from ltt ust channel to ust app channel */
@@
-1727,6
+1774,13
@@
static int create_ust_app_session(struct ltt_ust_session *usess,
app->pid, ret);
} else {
DBG("UST app creating session failed. Application is dead");
app->pid, ret);
} else {
DBG("UST app creating session failed. Application is dead");
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally. This will get flagged ENOTCONN and the
+ * caller will handle it.
+ */
+ ret = 0;
}
delete_ust_app_session(-1, ua_sess, app);
if (ret != -ENOMEM) {
}
delete_ust_app_session(-1, ua_sess, app);
if (ret != -ENOMEM) {
@@
-1795,6
+1849,7
@@
int create_ust_app_channel_context(struct ust_app_session *ua_sess,
lttng_ht_node_init_ulong(&ua_ctx->node, (unsigned long) ua_ctx->ctx.ctx);
lttng_ht_add_unique_ulong(ua_chan->ctx, &ua_ctx->node);
lttng_ht_node_init_ulong(&ua_ctx->node, (unsigned long) ua_ctx->ctx.ctx);
lttng_ht_add_unique_ulong(ua_chan->ctx, &ua_ctx->node);
+ cds_list_add_tail(&ua_ctx->list, &ua_chan->ctx_list);
ret = create_ust_channel_context(ua_chan, ua_ctx, app);
if (ret < 0) {
ret = create_ust_channel_context(ua_chan, ua_ctx, app);
if (ret < 0) {
@@
-2994,6
+3049,12
@@
int ust_app_list_events(struct lttng_event **events)
app->sock, ret);
} else {
DBG3("UST app tp list get failed. Application is dead");
app->sock, ret);
} else {
DBG3("UST app tp list get failed. Application is dead");
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally. Continue normal execution.
+ */
+ break;
}
goto rcu_error;
}
}
goto rcu_error;
}
@@
-3088,6
+3149,12
@@
int ust_app_list_event_fields(struct lttng_event_field **fields)
app->sock, ret);
} else {
DBG3("UST app tp list field failed. Application is dead");
app->sock, ret);
} else {
DBG3("UST app tp list field failed. Application is dead");
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ break;
}
goto rcu_error;
}
}
goto rcu_error;
}
@@
-3703,6
+3770,13
@@
skip_setup:
app->pid, ret);
} else {
DBG("UST app start session failed. Application is dead.");
app->pid, ret);
} else {
DBG("UST app start session failed. Application is dead.");
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ pthread_mutex_unlock(&ua_sess->lock);
+ goto end;
}
goto error_unlock;
}
}
goto error_unlock;
}
@@
-3778,6
+3852,12
@@
int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
app->pid, ret);
} else {
DBG("UST app stop session failed. Application is dead.");
app->pid, ret);
} else {
DBG("UST app stop session failed. Application is dead.");
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ goto end_unlock;
}
goto error_rcu_unlock;
}
}
goto error_rcu_unlock;
}
@@
-3801,6
+3881,7
@@
int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
(void) push_metadata(registry, ua_sess->consumer);
}
(void) push_metadata(registry, ua_sess->consumer);
}
+end_unlock:
pthread_mutex_unlock(&ua_sess->lock);
end_no_session:
rcu_read_unlock();
pthread_mutex_unlock(&ua_sess->lock);
end_no_session:
rcu_read_unlock();
@@
-3855,8
+3936,11
@@
int ust_app_flush_trace(struct ltt_ust_session *usess, struct ust_app *app)
} else {
DBG3("UST app failed to flush %s. Application is dead.",
ua_chan->name);
} else {
DBG3("UST app failed to flush %s. Application is dead.",
ua_chan->name);
- /* No need to continue. */
- break;
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
}
/* Continuing flushing all buffers */
continue;
}
/* Continuing flushing all buffers */
continue;
@@
-3962,7
+4046,7
@@
int ust_app_stop_trace_all(struct ltt_ust_session *usess)
}
}
}
}
- /* Flush buffers */
+ /* Flush buffers
and push metadata (for UID buffers).
*/
switch (usess->buffer_type) {
case LTTNG_BUFFER_PER_UID:
{
switch (usess->buffer_type) {
case LTTNG_BUFFER_PER_UID:
{
@@
-3970,6
+4054,7
@@
int ust_app_stop_trace_all(struct ltt_ust_session *usess)
/* Flush all per UID buffers associated to that session. */
cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
/* Flush all per UID buffers associated to that session. */
cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+ struct ust_registry_session *ust_session_reg;
struct buffer_reg_channel *reg_chan;
struct consumer_socket *socket;
struct buffer_reg_channel *reg_chan;
struct consumer_socket *socket;
@@
-3990,7
+4075,14
@@
int ust_app_stop_trace_all(struct ltt_ust_session *usess)
*/
(void) consumer_flush_channel(socket, reg_chan->consumer_key);
}
*/
(void) consumer_flush_channel(socket, reg_chan->consumer_key);
}
+
+ ust_session_reg = reg->registry->reg.ust;
+ if (!ust_session_reg->metadata_closed) {
+ /* Push metadata. */
+ (void) push_metadata(ust_session_reg, usess->consumer);
+ }
}
}
+
break;
}
case LTTNG_BUFFER_PER_PID:
break;
}
case LTTNG_BUFFER_PER_PID:
@@
-4044,7
+4136,7
@@
int ust_app_destroy_trace_all(struct ltt_ust_session *usess)
void ust_app_global_update(struct ltt_ust_session *usess, int sock)
{
int ret = 0;
void ust_app_global_update(struct ltt_ust_session *usess, int sock)
{
int ret = 0;
- struct lttng_ht_iter iter, uiter
, iter_ctx
;
+ struct lttng_ht_iter iter, uiter;
struct ust_app *app;
struct ust_app_session *ua_sess = NULL;
struct ust_app_channel *ua_chan;
struct ust_app *app;
struct ust_app_session *ua_sess = NULL;
struct ust_app_channel *ua_chan;
@@
-4116,8
+4208,11
@@
void ust_app_global_update(struct ltt_ust_session *usess, int sock)
}
}
}
}
- cds_lfht_for_each_entry(ua_chan->ctx->ht, &iter_ctx.iter, ua_ctx,
- node.node) {
+ /*
+ * Add context using the list so they are enabled in the same order the
+ * user added them.
+ */
+ cds_list_for_each_entry(ua_ctx, &ua_chan->ctx_list, list) {
ret = create_ust_channel_context(ua_chan, ua_ctx, app);
if (ret < 0) {
goto error_unlock;
ret = create_ust_channel_context(ua_chan, ua_ctx, app);
if (ret < 0) {
goto error_unlock;
@@
-4647,7
+4742,8
@@
static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name,
*/
ret_code = ust_registry_create_event(registry, chan_reg_key,
sobjd, cobjd, name, sig, nr_fields, fields, loglevel,
*/
ret_code = ust_registry_create_event(registry, chan_reg_key,
sobjd, cobjd, name, sig, nr_fields, fields, loglevel,
- model_emf_uri, ua_sess->buffer_type, &event_id);
+ model_emf_uri, ua_sess->buffer_type, &event_id,
+ app);
/*
* The return value is returned to ustctl so in case of an error, the
/*
* The return value is returned to ustctl so in case of an error, the
@@
-4932,7
+5028,7
@@
int ust_app_snapshot_record(struct ltt_ust_session *usess,
reg_chan->subbuf_size > max_stream_size) {
ret = -EINVAL;
DBG3("UST app snapshot record maximum stream size %" PRIu64
reg_chan->subbuf_size > max_stream_size) {
ret = -EINVAL;
DBG3("UST app snapshot record maximum stream size %" PRIu64
- " is smaller than subbuffer size of %
" PRIu64
,
+ " is smaller than subbuffer size of %
zu"
,
max_stream_size, reg_chan->subbuf_size);
goto error;
}
max_stream_size, reg_chan->subbuf_size);
goto error;
}
This page took
0.032498 seconds
and
5
git commands to generate.