X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=d297cf0a30cb68f34b123576aacd6893edd9b5a7;hb=3177a074b69835f56bef5787c2265d79248a3f8f;hp=0e97b944ca094722f4bb36f468455633e1333608;hpb=6e78b10e47913603de67e026a90aa592136392ef;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 0e97b944c..d297cf0a3 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -3142,8 +3142,19 @@ int create_ust_app_event(struct ust_app_session *ua_sess, /* Create it on the tracer side */ ret = create_ust_event(app, ua_sess, ua_chan, ua_event); if (ret < 0) { - /* Not found previously means that it does not exist on the tracer */ - assert(ret != -LTTNG_UST_ERR_EXIST); + /* + * Not found previously means that it does not exist on the + * tracer. If the application reports that the event existed, + * it means there is a bug in the sessiond or lttng-ust + * (or corruption, etc.) + */ + if (ret == -LTTNG_UST_ERR_EXIST) { + ERR("Tracer for application reported that an event being created already existed: " + "event_name = \"%s\", pid = %d, ppid = %d, uid = %d, gid = %d", + uevent->attr.name, + app->pid, app->ppid, app->uid, + app->gid); + } goto error; } @@ -5885,6 +5896,7 @@ enum lttng_error_code ust_app_snapshot_record( enum lttng_error_code status = LTTNG_OK; struct lttng_ht_iter iter; struct ust_app *app; + char *trace_path = NULL; assert(usess); assert(output); @@ -5899,7 +5911,6 @@ enum lttng_error_code ust_app_snapshot_record( cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) { struct buffer_reg_channel *reg_chan; struct consumer_socket *socket; - char *trace_path = NULL; char pathname[PATH_MAX]; if (!reg->registry->reg.ust->metadata_key) { @@ -5928,6 +5939,8 @@ enum lttng_error_code ust_app_snapshot_record( status = LTTNG_ERR_INVALID; goto error; } + /* Free path allowed on previous iteration. */ + free(trace_path); trace_path = setup_channel_trace_path(usess->consumer, pathname); if (!trace_path) { status = LTTNG_ERR_INVALID; @@ -5942,14 +5955,12 @@ enum lttng_error_code ust_app_snapshot_record( usess->gid, trace_path, wait, nb_packets_per_stream); if (status != LTTNG_OK) { - free(trace_path); goto error; } } status = consumer_snapshot_channel(socket, reg->registry->reg.ust->metadata_key, output, 1, usess->uid, usess->gid, trace_path, wait, 0); - free(trace_path); if (status != LTTNG_OK) { goto error; } @@ -5964,7 +5975,6 @@ enum lttng_error_code ust_app_snapshot_record( struct ust_app_channel *ua_chan; struct ust_app_session *ua_sess; struct ust_registry_session *registry; - char *trace_path = NULL; char pathname[PATH_MAX]; ua_sess = lookup_session_by_app(usess, app); @@ -5990,6 +6000,8 @@ enum lttng_error_code ust_app_snapshot_record( PERROR("snprintf snapshot path"); goto error; } + /* Free path allowed on previous iteration. */ + free(trace_path); trace_path = setup_channel_trace_path(usess->consumer, pathname); if (!trace_path) { status = LTTNG_ERR_INVALID; @@ -6009,10 +6021,8 @@ enum lttng_error_code ust_app_snapshot_record( case LTTNG_OK: break; case LTTNG_ERR_CHAN_NOT_FOUND: - free(trace_path); continue; default: - free(trace_path); goto error; } } @@ -6027,7 +6037,6 @@ enum lttng_error_code ust_app_snapshot_record( ua_sess->effective_credentials.uid, ua_sess->effective_credentials.gid, trace_path, wait, 0); - free(trace_path); switch (status) { case LTTNG_OK: break; @@ -6045,6 +6054,7 @@ enum lttng_error_code ust_app_snapshot_record( } error: + free(trace_path); rcu_read_unlock(); return status; }