Project

General

Profile

Actions

Bug #1303

closed

Crash on teardown of application when using 'perf' context

Added by Jérémie Galarneau about 3 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Start date:
04/07/2021
Due date:
% Done:

100%

Estimated time:

Description

With the current lttng-ust master (f1324c11), the gen-ust-events application launched by the regression/ust/test_event_perf LTTng-tools test crashes and causes the test to hang.

Here is the resulting stacktrace:

Core was generated by `./tests/regression/ust//../../utils/testapp/gen-ust-events/gen-ust-events -i 1'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fa9057d68c7 in cds_list_add (newp=0x55d17436a900, head=0x7fa90001b910) at /usr/include/urcu/list.h:53
53        head->next->prev = newp;
[Current thread is 1 (Thread 0x7fa905516f40 (LWP 193210))]
(gdb) bt
#0  0x00007fa9057d68c7 in cds_list_add (newp=0x55d17436a900, head=0x7fa90001b910) at /usr/include/urcu/list.h:53
#1  0x00007fa9057d672a in add_thread_field (perf_field=0x7fa90001b8a0, perf_thread=0x55d17436a8d0) at lttng-context-perf-counters.c:402
#2  0x00007fa9057d623a in get_thread_field (field=0x7fa90001b8a0) at lttng-context-perf-counters.c:428
#3  0x00007fa9057d613d in wrapper_perf_counter_read (priv=0x7fa90001b8a0) at lttng-context-perf-counters.c:438
#4  0x00007fa9057d5cfa in perf_counter_record (priv=0x7fa90001b8a0, ctx=0x7ffe0649bcb0, chan=0x7fa90001b1c0) at lttng-context-perf-counters.c:449
#5  0x00007fa9057dd7fd in ctx_record (bufctx=0x7ffe0649bcb0, chan=0x7fa90001b1c0, ctx=0x7fa90001b880) at ./lttng-ring-buffer-client-template.h:126
#6  0x00007fa9057e125b in lttng_write_event_header_slow (config=0x7fa905842628 <client_config>, ctx=0x7ffe0649bcb0, client_ctx=0x7ffe0649b860, 
    event_id=0) at ./lttng-ring-buffer-client-template.h:331
#7  0x00007fa9057dc490 in lttng_write_event_header (config=0x7fa905842628 <client_config>, ctx=0x7ffe0649bcb0, client_ctx=0x7ffe0649b860, 
    event_id=0) at ./lttng-ring-buffer-client-template.h:264
#8  0x00007fa9057d8d79 in lttng_event_reserve (ctx=0x7ffe0649bcb0) at ./lttng-ring-buffer-client-template.h:728
#9  0x000055d17244579c in __event_probe__tp___tptest (__tp_data=0x55d17436a6e0, anint=0, netint=0, values=0x7ffe0649bf80, 
    text=0x7ffe0649bf76 "test", textlen=4, etext=0x7ffe0649bf6c "\\*", net_values=0x7ffe0649bf50, doublearg=2, floatarg=2222) at ././tp.h:30
#10 0x000055d172444ce3 in __tracepoint_cb_tp___tptest (anint=0, netint=0, values=0x7ffe0649bf80, text=0x7ffe0649bf76 "test", textlen=4, 
    etext=0x7ffe0649bf6c "\\*", net_values=0x7ffe0649bf50, doublearg=2, floatarg=2222) at ./tp.h:30
#11 main (argc=5, argv=0x7ffe0649c128) at gen-ust-events.c:149

Note that this test must be run as root.

Going a couple commits back in time a couple of days (b670e9e8), a double-free occurs in the same test:

Core was generated by `./tests/regression/ust//../../utils/testapp/gen-ust-events/gen-ust-events -i 1'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007f19a605bef5 in raise () from /usr/lib/libc.so.6
[Current thread is 1 (Thread 0x7f19a601af40 (LWP 226209))]
(gdb) bt
#0  0x00007f19a605bef5 in raise () from /usr/lib/libc.so.6
#1  0x00007f19a6045862 in abort () from /usr/lib/libc.so.6
#2  0x00007f19a609df38 in __libc_message () from /usr/lib/libc.so.6
#3  0x00007f19a60a5bea in malloc_printerr () from /usr/lib/libc.so.6
#4  0x00007f19a60a76c8 in _int_free () from /usr/lib/libc.so.6
#5  0x00007f19a60aaca8 in free () from /usr/lib/libc.so.6
#6  0x00007f19a62bdd3e in lttng_destroy_context (ctx=0x7f19a001bf60) at lttng-context.c:275
#7  0x00007f19a62c04a3 in _lttng_channel_unmap (lttng_chan=0x7f19a001b840) at lttng-events.c:257
#8  0x00007f19a62c0177 in lttng_session_destroy (session=0x7f19a000a3b0) at lttng-events.c:332
#9  0x00007f19a6295f7b in lttng_release_session (objd=3) at lttng-ust-abi.c:662
#10 0x00007f19a6295339 in lttng_ust_abi_objd_unref (id=3, is_owner=0) at lttng-ust-abi.c:211
#11 0x00007f19a6296a7c in lttng_channel_release (objd=4) at lttng-ust-abi.c:1266
#12 0x00007f19a6295339 in lttng_ust_abi_objd_unref (id=4, is_owner=0) at lttng-ust-abi.c:211
#13 0x00007f19a6296e1b in lttng_event_enabler_release (objd=5) at lttng-ust-abi.c:1337
#14 0x00007f19a6295339 in lttng_ust_abi_objd_unref (id=5, is_owner=1) at lttng-ust-abi.c:211
#15 0x00007f19a62958ca in objd_table_destroy () at lttng-ust-abi.c:230
#16 0x00007f19a6295858 in lttng_ust_abi_exit () at lttng-ust-abi.c:1351
#17 0x00007f19a628dcfd in lttng_ust_cleanup (exiting=1) at lttng-ust-comm.c:2263
#18 0x00007f19a628dc85 in lttng_ust_exit () at lttng-ust-comm.c:2327
#19 0x00007f19a63a823b in _dl_fini () from /lib64/ld-linux-x86-64.so.2
#20 0x00007f19a605e697 in __run_exit_handlers () from /usr/lib/libc.so.6
#21 0x00007f19a605e83e in exit () from /usr/lib/libc.so.6
#22 0x000055b8d9eede8f in main (argc=5, argv=0x7fffa56f4008) at gen-ust-events.c:195
Actions #1

Updated by Mathieu Desnoyers about 3 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF