Fix: ustcomm: application name uses the '-ust'-suffixed thread name
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 14 May 2021 23:13:32 +0000 (19:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 15 May 2021 00:52:58 +0000 (20:52 -0400)
commit046bc54cf5dbbe9106c5cfd0fc324e386b5bc3cf
tree36e906179c34fe5f645905b24e07e72f3627920d
parent6825ea4493cbd97e428def01d1cf3b94477e4912
Fix: ustcomm: application name uses the '-ust'-suffixed thread name

During the 2.13 development cycle, the compatibility pthread_setname_np
compatibility layer was fixed (see 0db3d6ee). Unfortunately, this had a
detrimental effect.

Upon the registration of an application to the session daemon, its name
is sent as part of the 'struct lttng_ust_ctl_reg_msg' registration
message. The application name is sampled using lttng_pthread_getname_np
during the preparation of the message.

However, when the listener thread is launched, its name is changed
early-on to add a '-ust' suffix (see 01f0e40c). This suffixed name is
sampled and sent to the session daemon. Since, until recently, the
pthread_setname_np had no effect on most configurations, this had no
consequence.

I noticed that this has a ripple-effect in the generation of some
path names. For instance, in per-pid mode, snapshots end-up with the
following hierarchy:

/home/jgalar/lttng-traces
└── Mercury
    └── florence_jacques-20210514-162630
        └── snapshot-0-20210514-162726-1
            └── ust
                └── pid
                    └── hello-ust-332607-20210514-162538
                        ├── lol_0
                        ├── lol_1
                        ├── lol_10
                        ├── lol_11
                        ├── lol_2
                        ├── lol_3
                        ├── lol_4
                        ├── lol_5
                        ├── lol_6
                        ├── lol_7
                        ├── lol_8
                        ├── lol_9
                        └── metadata

Notice how the 'hello' application presents itself with the '-ust'
prefix. For such a short application name, it doesn't really matter
much beyond repeating the 'ust' unnecessarily. However, longer
application names quickly become less readable as we lose four of
the 16 precious allowed characters for a process name.

The procname sampled during the execution of the constructors is
reused. My understanding is that the procname stored in the sock_info
is already used for the 'procname' context.

The resulting hierarchy becomes:

/home/jgalar/lttng-traces
└── Mercury
    └── sylvie_rouillard-20210514-193524
        └── snapshot-0-20210514-193553-0
            └── ust
                └── pid
                    └── hello-466576-20210514-193514
                        ├── lol_0
                        ├── lol_1
                        ├── lol_10
                        ├── lol_11
                        ├── lol_2
                        ├── lol_3
                        ├── lol_4
                        ├── lol_5
                        ├── lol_6
                        ├── lol_7
                        ├── lol_8
                        ├── lol_9
                        └── metadata

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd6f4763c96ea5fb680f55e5cc3d250baca175b0
src/common/ustcomm.c
src/common/ustcomm.h
src/lib/lttng-ust/lttng-ust-comm.c
This page took 0.025875 seconds and 4 git commands to generate.