<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>The attached patch works around the issue. The problem is<br></div><div>the tracepoint destructors that run in parallel with the thread<br data-mce-bogus="1"></div><div>that still exists.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>If we remove this, we leak the liblttng-ust-tracepoint.so.0 shared<br data-mce-bogus="1"></div><div>object on dlclose of the instrumented code. Not sure if we should<br data-mce-bogus="1"></div><div>care though...<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Thoughts ?<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Thanks,<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Mathieu<br data-mce-bogus="1"></div><div><br></div><div><br></div><div><span id="zwchr" data-marker="__DIVIDER__">----- On Mar 8, 2016, at 7:35 PM, Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:<br></span></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Reproduced it on master (ust and tools).<br></div><br><div>Repro with:<br></div><br><div>lttng create<br></div><div>lttng enable-event -u -a<br></div><div>lttng start<br></div><br><div>then run hello a few times, it eventually segfaults in the spawned thread.<br></div><br><div>Looking into it.<br></div><br><div>Thanks,<br></div><br><div>Mathieu<br></div><br><span id="zwchr">----- On Mar 8, 2016, at 7:12 PM, Jonathan Rajotte Julien <Jonathan.rajotte-julien@efficios.com> wrote:<br></span><div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">Hi Jeffrey,<br>
    <br>
    Could you provide the version for lttng-ust, lttng-tools,
    lttng-modules (if installed)?<br>
    <br>
    Were you able to reproduce the issue on master (git) ?<br>
    <br>
    What are the exact order of command to reproduce the problem ?<br>
    <br>
    Thanks<br>
    <br>
    <div class="moz-cite-prefix">On 2016-03-08 06:43 PM, Jeffrey Chen
      wrote:<br>
    </div>
    <blockquote cite="mid:DM3PR13MB0782B678A6ECD858863C1A8CC7B20@DM3PR13MB0782.namprd13.prod.outlook.com">
      
      <style style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <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><span style="text-decoration: underline;">hello-tp.c</span></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><span style="text-decoration: underline;">hello-tp.h</span></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><span style="text-decoration: underline;">Compile</span></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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
lttng-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature">-- 
Jonathan R. Julien
Efficios</pre>
  

<br>_______________________________________________<br>lttng-dev mailing list<br>lttng-dev@lists.lttng.org<br>http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev<br></blockquote></div><br><div>-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com</div></div><br>_______________________________________________<br>lttng-dev mailing list<br>lttng-dev@lists.lttng.org<br>http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev<br></blockquote></div><div><br></div><div data-marker="__SIG_POST__">-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com</div></div></body></html>