<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi LTTng community:</p>
<p><br>
</p>
<p>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?</p>
<p><br>
</p>
<p><br>
</p>
<p><b><u>hello.c</u></b><br>
</p>
<p>#include <stdio.h><br>
#include "hello-tp.h"<br>
#include <pthread.h><br>
<br>
<br>
void* doSomeThing(void *arg)<br>
{<br>
    int x;<br>
    for (x = 0; x < 100000; ++x) {<br>
        tracepoint(hello_world, my_first_tracepoint, x, "test");<br>
    }<br>
}<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
    int x;<br>
<br>
    getchar();<br>
<br>
    pthread_t inc_x_thread;<br>
<br>
    if(pthread_create(&inc_x_thread, NULL, doSomeThing, NULL)) {<br>
    <br>
        fprintf(stderr, "Error creating thread\n");<br>
        return 1;<br>
    }<br>
<br>
    tracepoint(hello_world, my_first_tracepoint, 23, "hi there!");<br>
<br>
    return 0;<br>
}</p>
<p><br>
</p>
<p><b><u>hello-tp.c</u></b><br>
</p>
<p>#define TRACEPOINT_CREATE_PROBES<br>
#define TRACEPOINT_DEFINE<br>
<br>
#include "hello-tp.h"<br>
</p>
<p><br>
</p>
<p><b><u>hello-tp.h</u></b></p>
<p>#undef TRACEPOINT_PROVIDER<br>
#define TRACEPOINT_PROVIDER hello_world<br>
<br>
#undef TRACEPOINT_INCLUDE<br>
#define TRACEPOINT_INCLUDE "./hello-tp.h"<br>
<br>
#if !defined(_HELLO_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)<br>
#define _HELLO_TP_H<br>
<br>
#include <lttng/tracepoint.h><br>
<br>
TRACEPOINT_EVENT(<br>
    hello_world,<br>
    my_first_tracepoint,<br>
    TP_ARGS(<br>
        int, my_integer_arg,<br>
        char*, my_string_arg<br>
    ),<br>
    TP_FIELDS(<br>
        ctf_string(my_string_field, my_string_arg)<br>
        ctf_integer(int, my_integer_field, my_integer_arg)<br>
    )<br>
)<br>
<br>
#endif /* _HELLO_TP_H */<br>
<br>
#include <lttng/tracepoint-event.h><br>
</p>
<p><br>
</p>
<p><b><u>Compile</u></b></p>
<p>gcc -c -I. hello-tp.c<br>
gcc -c hello.c<br>
gcc -o hello hello.o hello-tp.o -llttng-ust -ldl -lpthread<br>
<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
</div>
</body>
</html>