[lttng-dev] segfault when exiting process with background thread

Jonathan Rajotte Julien Jonathan.rajotte-julien at efficios.com
Wed Mar 9 00:12:54 UTC 2016


Hi Jeffrey,

Could you provide the version for lttng-ust, lttng-tools, lttng-modules 
(if installed)?

Were you able to reproduce the issue on master (git) ?

What are the exact order of command to reproduce the problem ?

Thanks

On 2016-03-08 06:43 PM, Jeffrey Chen wrote:
>
> Hi LTTng community:
>
>
> We are using LTTng for our production environment. We have been 
> noticing segfault problem when our process exit. We think the problem 
> is due to the background thread continue to write traces, while LTTng 
> cleanup its memory. We do not know how to fix this issue without 
> changing LTTng code base. I have written a very simple app that could 
> repro the problem. Most of my codes are copy pasted from the LTTng doc 
> sample. Is there any fix that the LTTng side could do?
>
>
>
> *_hello.c_*
>
> #include <stdio.h>
> #include "hello-tp.h"
> #include <pthread.h>
>
>
> void* doSomeThing(void *arg)
> {
>     int x;
>     for (x = 0; x < 100000; ++x) {
>         tracepoint(hello_world, my_first_tracepoint, x, "test");
>     }
> }
>
> int main(int argc, char *argv[])
> {
>     int x;
>
>     getchar();
>
>     pthread_t inc_x_thread;
>
>     if(pthread_create(&inc_x_thread, NULL, doSomeThing, NULL)) {
>
>         fprintf(stderr, "Error creating thread\n");
>         return 1;
>     }
>
>     tracepoint(hello_world, my_first_tracepoint, 23, "hi there!");
>
>     return 0;
> }
>
>
> *_hello-tp.c_*
>
> #define TRACEPOINT_CREATE_PROBES
> #define TRACEPOINT_DEFINE
>
> #include "hello-tp.h"
>
>
> *_hello-tp.h_*
>
> #undef TRACEPOINT_PROVIDER
> #define TRACEPOINT_PROVIDER hello_world
>
> #undef TRACEPOINT_INCLUDE
> #define TRACEPOINT_INCLUDE "./hello-tp.h"
>
> #if !defined(_HELLO_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
> #define _HELLO_TP_H
>
> #include <lttng/tracepoint.h>
>
> TRACEPOINT_EVENT(
>     hello_world,
>     my_first_tracepoint,
>     TP_ARGS(
>         int, my_integer_arg,
>         char*, my_string_arg
>     ),
>     TP_FIELDS(
>         ctf_string(my_string_field, my_string_arg)
>         ctf_integer(int, my_integer_field, my_integer_arg)
>     )
> )
>
> #endif /* _HELLO_TP_H */
>
> #include <lttng/tracepoint-event.h>
>
>
> *_Compile_*
>
> gcc -c -I. hello-tp.c
> gcc -c hello.c
> gcc -o hello hello.o hello-tp.o -llttng-ust -ldl -lpthread
>
>
>
>
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Jonathan R. Julien
Efficios

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20160308/391b7e74/attachment-0001.html>


More information about the lttng-dev mailing list