Project

General

Profile

Actions

Bug #473

closed

Can't trace long double payload field?

Added by Daniel U. Thibault about 11 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
Start date:
03/12/2013
Due date:
% Done:

100%

Estimated time:

Description

Once more using lttng-ust/doc/examples/easy-ust/, I have:

sample.c

[...]
#include <unistd.h>
#include <complex.h> //for _Complex types
#define TRACEPOINT_DEFINE
#include "sample_component_provider.h" 

int main(int argc, char **argv)
{
    int i = 0;

    for (i = 0; i < 2000; i++) {
        tracepoint(sample_component, message, "Hello World", 1.E+2f, 1.E+3, 1.E+4L);
        usleep(10);
    }
    return 0;
}

sample_component_provider.h

[...]
TRACEPOINT_EVENT(
    sample_component,
    message,
    TP_ARGS(char *, text, float, floatvalue, double, doublevalue, long double, longdoublevalue),
    TP_FIELDS(
        ctf_string(message, text)
        ctf_float(float, floatfield, floatvalue)
        ctf_float(double, doublefield, doublevalue)
        ctf_float(long double, longdoublefield, longdoublevalue)
    )
)
[...]

Now I try to create a trace:

$ lttng create mylocalsession
Session mylocalsession created.
Traces will be written in /home/daniel/lttng-traces/mylocalsession-20130312-121313
$ lttng enable-event -u --all
All UST events are enabled in channel channel0
$ lttng start
Tracing started for session mylocalsession
$ lttng destroy
Session mylocalsession destroyed

Between lttng start and lttng destroy I run ./sample from another console.

I get no error messages whatsovever, but the resulting trace has what seems like a correct metadata file...but an empty channel0_0 file (probably not truly empty, just closed incorrectly).

The same exercise, omitting the long double value, works fine.


Files

metadata (8 KB) metadata metadata of (failed) trace of float/double/longdouble UST event Daniel U. Thibault, 03/12/2013 12:39 PM
channel0_0 (88 KB) channel0_0 channel0_0 for the double _Complex failed trace Daniel U. Thibault, 03/12/2013 01:55 PM
metadata (8 KB) metadata metadata for the double _Complex failed trace Daniel U. Thibault, 03/12/2013 01:55 PM
Actions #1

Updated by Mathieu Desnoyers about 11 years ago

Please attach your metadata file to the bug.

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

Actions #2

Updated by Daniel U. Thibault about 11 years ago

Attached.

Updated by Daniel U. Thibault about 11 years ago

I run into similar trouble with double _Complex payload fields:

    TP_ARGS(char *, text, float, floatvalue, double, doublevalue, double _Complex, doublecomplexvalue),
    TP_FIELDS(
        ctf_string(message, text)
        ctf_float(float, floatfield, floatvalue)
        ctf_float(double, doublefield, doublevalue)

#include <unistd.h>
#include <complex.h> //for _Complex types
#define TRACEPOINT_DEFINE
#include "sample_component_provider.h" 

int main(int argc, char **argv)
{
    int i = 0;
    double _Complex dc = 6.2 + 7.3*I;

    for (i = 0; i < 2000; i++) {
        tracepoint(sample_component, message, "Hello World", 1.2345E+2f, 1.23456E+3, dc);
$ babeltrace -v ~/lttng-traces/mydoublecomplex-20130312-140047/ -w ~/lttng-traces/mydoublecomplex_n_all_f_all -n all -f all
[verbose] Verbose mode active.
[verbose] Converting from directory(ies):
[verbose]     /home/daniel/lttng-traces/mydoublecomplex-20130312-140047/
[verbose] Converting from format: ctf <default>
[verbose] Converting to directory: /home/daniel/lttng-traces/mydoublecomplex_n_all_f_all
[verbose] Converting to format: text <default>
[verbose] CTF visitor: parent links creation... [verbose] done.
[verbose] CTF visitor: semantic check... [verbose] done.
[verbose] CTF visitor: metadata construction... [verbose] env.hostname = "edge-vb-u12" 
[verbose] env.domain = "ust" 
[verbose] env.tracer_name = "lttng-ust" 
[verbose] env.tracer_major = 2
[verbose] env.tracer_minor = 1
[verbose] env.tracer_patchlevel = 0
[verbose] env.vpid = 10421
[verbose] env.procname = "sample" 
[verbose] done.
[error] Unexpected end of stream. Either the trace data stream is corrupted or metadata description does not match data layout.
[error] Reading event failed.
Error printing trace.

The trace files are attached. Note that a similar trial with float _Complex did not crash but reports suspicious values for the field: the event wrote (5.0 + 3.1 i) but babeltrace reads "44.8".

Actions #4

Updated by Mathieu Desnoyers about 11 years ago

  • Assignee set to David Goulet

When an event containing a float type is received by the sessiond, it should check the mant_dig value, and if it is 0, it should print an ERR and return an error to lttng-ust.

Actions #5

Updated by Daniel U. Thibault about 11 years ago

Not sure if this is related, but here goes. Using:

sample.c

#include <unistd.h>
#include <complex.h> //for _Complex types
#define TRACEPOINT_DEFINE
#include "sample_component_provider.h" 

int main(int argc, char **argv)
{
    int i = 0;

    for (i = 0; i < 2000; i++) {
        tracepoint(sample_component, message, "Hello World", 1.2345678E+38f, 1.2345678E+308);
        usleep(10);
    }
    return 0;
}

sample_component_provider.h

[...]
TRACEPOINT_EVENT(
    sample_component,
    message,
    TP_ARGS(char *, text, float, floatvalue, double, doublevalue),
    TP_FIELDS(
        ctf_string(message, text)
        ctf_float(float, floatfield, floatvalue)
        ctf_float(double, doublefield, doublevalue)
    )
)
[...]

If I then do:

$ lttng create mysingledouble
Session mysingledouble created.
Traces will be written in /home/daniel/lttng-traces/mysingledouble-20130312-170253
$ lttng enable-event -u --all
All UST events are enabled in channel channel0
$ lttng start
Tracing started for session mysingledouble
$ lttng-sessiond: main.c:1258: send_socket_to_thread: Assertion `fd >= 0' failed.

I ran ./sample after the lttng start. Above, lttng-sessiond, lttng-consumerd both die and the trace is lost. If I then repeat the procedure:

$ lttng create mysingledouble
Session mysingledouble created.
Traces will be written in /home/daniel/lttng-traces/mysingledouble-20130312-170714
$ lttng enable-event -u --all
All UST events are enabled in channel channel0
$ lttng start
Tracing started for session mysingledouble
$ PERROR [11164/11170]: epoll_wait: Invalid argument (in compat_epoll_wait() at compat-epoll.c:229)
$ lttng destroy
Session mysingledouble destroyed

I get a normal trace. What is really suspicious is that the two outcomes alternate with perfect regularity if I continue trying to trace again and again.

Actions #6

Updated by David Goulet over 10 years ago

  • Status changed from New to Confirmed
  • Assignee deleted (David Goulet)
  • Target version set to 2.2
Actions #7

Updated by Mathieu Desnoyers over 10 years ago

About the 3 bugs filed here (please file separately next time):

1) I'm preparing a patch to ensure sessiond refuses events that contain a long double field.

2) double _Complex is unsupported, so the behavior is undefined. Please file a feature request separately against lttng-ust if this feature request does not already exist.

3) the assert() in sessiond seems to be unrelated. Please file a separate bug report if you can reproduce against an updated lttng.

Actions #8

Updated by Mathieu Desnoyers over 10 years ago

  • Status changed from Confirmed to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Daniel U. Thibault over 10 years ago

Mathieu Desnoyers wrote:

1) I'm preparing a patch to ensure sessiond refuses events that contain a long double field.

2) double _Complex is unsupported, so the behavior is undefined. Please file a feature request separately against lttng-ust if this feature request does not already exist.

3) the assert() in sessiond seems to be unrelated. Please file a separate bug report if you can reproduce against an updated lttng.

I'm unable to reproduce the assertion failure with LTTng 2.3.0-rc3. Must have been a fluke.

Long double fields compile in trace provider code and the event registration is rejected by sessiond. Is the intent that when/if lttng-sessiond accepts long double fields (once babeltrace does, I guess), the trace providers will start working without needing recompilation?

Actions

Also available in: Atom PDF