Skip to contentSkip to conversation

UST context causes empty trace

DISCUSSION Mathieu Desnoyers 3 participants 4 messages May 12, 2013 – May 13, 2013 3 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Yes, it's broken here too. Can you open a bug report against UST please?

it looks like those are missing when we enable UST contexts:

libust[26034/26049]: Sent register channel notification: chan_id 0, header_type 1
(in ustcomm_register_channel() at lttng-ust-comm.c:1053)
[...]
libust[26034/26034]: Sent register event notification for name "ust_tests_hello:tptest": ret_code 0, event_id 0
(in ustcomm_register_event() at lttng-ust-comm.c:948)
libust[26034/26034]: Sent register event notification for name "ust_tests_hello:tptest_sighandler": ret_code 0, event_id 1
(in ustcomm_register_event() at lttng-ust-comm.c:948)

(I get those in a run where I don't enable any UST context, but not in the problematic case)

the rest seems to be there when launching the app with LTTNG_UST_DEBUG=1 env var set. So it looks like an issue within UST.

Thanks,

Mathieu

Quoted 28 lines · * Francis Giraldeau ([email protected]) wrote:

With 2.2.0-rc2, when enabling some context for UST, the generated trace is empty. Here is a small script to reproduce the problem:

$ cat do.sh
lttng create
lttng enable-channel u -u
lttng enable-event -c u -a -u
lttng add-context -c u -u -t vpid -t vtid
lttng start
$@
lttng stop
lttng view
lttng destroy

When commenting out the "add-context" command, then the trace is generated correctly. Does someone else is able to confirm the problem?

Thanks,

Francis Giraldeau

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#3 lore raw
In reply to a message not in the archive

Hi,

I did some debugging one this issue. The problem only occurs when we have more than one context field.
So this will not work, too:

lttng create
lttng enable-event -a -u
lttng add-context -u -t vpid
lttng add-context -u -t vtid
lttng start
$@
lttng stop
sleep 1
lttng view
lttng destroy

The problem I found out is wrong fields argument passed into ustcomm_register_channel.
The fields argument passed is a pointer to the event_field of the first element in a lttng_ctx_field array,
but not a lttng_event_field array as expected.

Please see the patch for more details.

The patch works on my machine. But I wonder if there is something wrong or maybe a better fix.
Please review.

Thanks,

Zifei Tong

---
 liblttng-ust/lttng-events.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
liblttng-ust/lttng-events.c +7 -2
index e4faf60..7afe13f 100644
@@ -260,9 +260,10 @@ int lttng_session_enable(struct lttng_session *session)
 	 */
 	cds_list_for_each_entry(chan, &session->chan_head, node) {
 		const struct lttng_ctx *ctx;
-		const struct lttng_event_field *fields = NULL;
+		struct lttng_event_field *fields = NULL;
 		size_t nr_fields = 0;
 		uint32_t chan_id;
+		int i;
 
 		/* don't change it if session stop/restart */
 		if (chan->header_type)
@@ -270,7 +271,9 @@ int lttng_session_enable(struct lttng_session *session)
 		ctx = chan->ctx;
 		if (ctx) {
 			nr_fields = ctx->nr_fields;
-			fields = &ctx->fields->event_field;
+			fields = malloc(nr_fields * sizeof(struct lttng_event_field));
+			for (i = 0; i < nr_fields; i++)
+				fields[i] = ctx->fields[i].event_field;
 		}
 		ret = ustcomm_register_channel(notify_socket,
 			session->objd,
@@ -279,6 +282,8 @@ int lttng_session_enable(struct lttng_session *session)
 			fields,
 			&chan_id,
 			&chan->header_type);
+		if (fields != NULL)
+			free(fields);
 		if (ret) {
 			DBG("Error (%d) registering channel to sessiond", ret);
 			return ret;
Signature · 1 line
1.8.2.2
Quoted 66 lines · Mathieu Desnoyers

Yes, it's broken here too. Can you open a bug report against UST please?

it looks like those are missing when we enable UST contexts:

libust[26034/26049]: Sent register channel notification: chan_id 0, header_type 1
(in ustcomm_register_channel() at lttng-ust-comm.c:1053)
[...]
libust[26034/26034]: Sent register event notification for name "ust_tests_hello:tptest": ret_code 0, event_id 0
(in ustcomm_register_event() at lttng-ust-comm.c:948)
libust[26034/26034]: Sent register event notification for name "ust_tests_hello:tptest_sighandler": ret_code 0, event_id 1
(in ustcomm_register_event() at lttng-ust-comm.c:948)

(I get those in a run where I don't enable any UST context, but not in the problematic case)

the rest seems to be there when launching the app with LTTNG_UST_DEBUG=1 env var set. So it looks like an issue within UST.

Thanks,

Mathieu

Quoted 24 lines · * Francis Giraldeau ([email protected]) wrote:

With 2.2.0-rc2, when enabling some context for UST, the generated trace is empty. Here is a small script to reproduce the problem:

$ cat do.sh
lttng create
lttng enable-channel u -u
lttng enable-event -c u -a -u
lttng add-context -c u -u -t vpid -t vtid
lttng start
$@
lttng stop
lttng view
lttng destroy

When commenting out the "add-context" command, then the trace is generated correctly. Does someone else is able to confirm the problem?

Thanks,

Francis Giraldeau

Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 11 lines
--
Best Regards,
仝子飞 (Zifei Tong)
College of Computer Science and Technology, Zhejiang University

[email protected] / [email protected]

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#5 lore raw
In reply to a message not in the archive

I confirm that this patch solved the problem.

Thanks!

Francis

Quoted 66 lines · Zifei Tong

Hi,

I did some debugging one this issue. The problem only occurs when we have more than one context field.
So this will not work, too:

lttng create
lttng enable-event -a -u
lttng add-context -u -t vpid
lttng add-context -u -t vtid
lttng start
$@
lttng stop
sleep 1
lttng view
lttng destroy

The problem I found out is wrong fields argument passed into ustcomm_register_channel.
The fields argument passed is a pointer to the event_field of the first element in a lttng_ctx_field array,
but not a lttng_event_field array as expected.

Please see the patch for more details.

The patch works on my machine. But I wonder if there is something wrong or maybe a better fix.
Please review.

Thanks,

Zifei Tong

---
 liblttng-ust/lttng-events.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
liblttng-ust/lttng-events.c +5 -2
index e4faf60..7afe13f 100644
@@ -260,9 +260,10 @@ int lttng_session_enable(struct lttng_session *session)
 	 */
 	cds_list_for_each_entry(chan, &session->chan_head, node) {
 		const struct lttng_ctx *ctx;
-		const struct lttng_event_field *fields = NULL;
+		struct lttng_event_field *fields = NULL;
 		size_t nr_fields = 0;
 		uint32_t chan_id;
+		int i;
 
 		/* don't change it if session stop/restart */
 		if (chan->header_type)
@@ -270,7 +271,9 @@ int lttng_session_enable(struct lttng_session *session)
 		ctx = chan->ctx;
 		if (ctx) {
 			nr_fields = ctx->nr_fields;
-			fields = &ctx->fields->event_field;
+			fields = malloc(nr_fields * sizeof(struct lttng_event_field));
+			for (i = 0; i < nr_fields; i++)
+				fields[i] = ctx->fields[i].event_field;
 		}
 		ret = ustcomm_register_channel(notify_socket,
 			session->objd,

liblttng-ust/lttng-events.c int lttng_session_enable(struct lttng_session *session) · line 289

Quoted 8 lines
liblttng-ust/lttng-events.c +2 -0
@@ -279,6 +282,8 @@ int lttng_session_enable(struct lttng_session *session)
 			fields,
 			&chan_id,
 			&chan->header_type);
+		if (fields != NULL)
+			free(fields);
 		if (ret) {
 			DBG("Error (%d) registering channel to sessiond", ret);
 			return ret;

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#6 lore raw
In reply to a message not in the archive

Fixed by:

commit 83e43212040a26aca40a4f8fefaa3682e9edaa57

Author: Mathieu Desnoyers <[email protected]>
Date:   Mon May 13 06:02:55 2013 -0400

Fix: incorrect support for multi-context

* Zifei Tong <[email protected]> wrote:
> I did some debugging one this issue. The problem only occurs when we > have more than one context field.
> So this will not work, too:
>
> lttng create
> lttng enable-event -a -u
> lttng add-context -u -t vpid
> lttng add-context -u -t vtid
> lttng start
> $@
> lttng stop
> sleep 1
> lttng view
> lttng destroy
>
> The problem I found out is wrong fields argument passed into > ustcomm_register_channel.
> The fields argument passed is a pointer to the event_field of the > first element in a lttng_ctx_field array, but not a
> lttng_event_field array as expected.

Fixes #529

Thanks!

Mathieu

Quoted 153 lines · * Zifei Tong ([email protected]) wrote:

Hi,

I did some debugging one this issue. The problem only occurs when we have more than one context field.
So this will not work, too:

lttng create
lttng enable-event -a -u
lttng add-context -u -t vpid
lttng add-context -u -t vtid
lttng start
$@
lttng stop
sleep 1
lttng view
lttng destroy

The problem I found out is wrong fields argument passed into ustcomm_register_channel.
The fields argument passed is a pointer to the event_field of the first element in a lttng_ctx_field array,
but not a lttng_event_field array as expected.

Please see the patch for more details.

The patch works on my machine. But I wonder if there is something wrong or maybe a better fix.
Please review.

Thanks,

Zifei Tong

---
 liblttng-ust/lttng-events.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
liblttng-ust/lttng-events.c +7 -2
index e4faf60..7afe13f 100644
@@ -260,9 +260,10 @@ int lttng_session_enable(struct lttng_session *session)
 	 */
 	cds_list_for_each_entry(chan, &session->chan_head, node) {
 		const struct lttng_ctx *ctx;
-		const struct lttng_event_field *fields = NULL;
+		struct lttng_event_field *fields = NULL;
 		size_t nr_fields = 0;
 		uint32_t chan_id;
+		int i;
 
 		/* don't change it if session stop/restart */
 		if (chan->header_type)
@@ -270,7 +271,9 @@ int lttng_session_enable(struct lttng_session *session)
 		ctx = chan->ctx;
 		if (ctx) {
 			nr_fields = ctx->nr_fields;
-			fields = &ctx->fields->event_field;
+			fields = malloc(nr_fields * sizeof(struct lttng_event_field));
+			for (i = 0; i < nr_fields; i++)
+				fields[i] = ctx->fields[i].event_field;
 		}
 		ret = ustcomm_register_channel(notify_socket,
 			session->objd,
@@ -279,6 +282,8 @@ int lttng_session_enable(struct lttng_session *session)
 			fields,
 			&chan_id,
 			&chan->header_type);
+		if (fields != NULL)
+			free(fields);
 		if (ret) {
 			DBG("Error (%d) registering channel to sessiond", ret);
 			return ret;
Signature · 1 line
1.8.2.2
Quoted 66 lines · Mathieu Desnoyers

Yes, it's broken here too. Can you open a bug report against UST please?

it looks like those are missing when we enable UST contexts:

libust[26034/26049]: Sent register channel notification: chan_id 0, header_type 1
(in ustcomm_register_channel() at lttng-ust-comm.c:1053)
[...]
libust[26034/26034]: Sent register event notification for name "ust_tests_hello:tptest": ret_code 0, event_id 0
(in ustcomm_register_event() at lttng-ust-comm.c:948)
libust[26034/26034]: Sent register event notification for name "ust_tests_hello:tptest_sighandler": ret_code 0, event_id 1
(in ustcomm_register_event() at lttng-ust-comm.c:948)

(I get those in a run where I don't enable any UST context, but not in the problematic case)

the rest seems to be there when launching the app with LTTNG_UST_DEBUG=1 env var set. So it looks like an issue within UST.

Thanks,

Mathieu

Quoted 24 lines · * Francis Giraldeau ([email protected]) wrote:

With 2.2.0-rc2, when enabling some context for UST, the generated trace is empty. Here is a small script to reproduce the problem:

$ cat do.sh
lttng create
lttng enable-channel u -u
lttng enable-event -c u -a -u
lttng add-context -c u -u -t vpid -t vtid
lttng start
$@
lttng stop
lttng view
lttng destroy

When commenting out the "add-context" command, then the trace is generated correctly. Does someone else is able to confirm the problem?

Thanks,

Francis Giraldeau

Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 6 lines
--
Best Regards,
仝子飞 (Zifei Tong)
College of Computer Science and Technology, Zhejiang University

[email protected] / [email protected]
Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev