<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi,<br></div><div><br data-mce-bogus="1"></div><div>LTTng-UST 2.6 is end of life. Please upgrade to a new version.<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><span id="zwchr" data-marker="__DIVIDER__">----- On Jun 23, 2016, at 2:03 AM, Aravind HT <aravind.ht@gmail.com> wrote:<br></span><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 dir="ltr">Hi,<br><div>I am facing a deadlock in lttng-ust. Though my version is 2.6 I can see that this is applicable to the the latest UST version also.</div><br><div>Deadlocks happening due to these two flows</div><div>1. <span style="font-size:10.5pt;font-family:Calibri,sans-serif;color:black">lttng_fix_pending_events () -><b> </b></span><span style="color:black;font-family:Calibri,sans-serif;font-size:10.5pt">ustcomm_register_event () -> calloc() -> </span><span style="color:black;font-family:Calibri,sans-serif;font-size:10.5pt">__GI___dl_iterate_phdr()</span></div><div><span style="color:black;font-family:Calibri,sans-serif;font-size:10.5pt"> Note that Im not using the libc wrapper, but using a proprietary version for malloc() family which can call </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">__GI___dl_iterate_phdr()</span><span style="color:black;font-family:Calibri,sans-serif;font-size:10.5pt"> .</span></div><div><span style="color:black;font-family:Calibri,sans-serif;font-size:10.5pt"> This flow takes up UST_LOCK() before calling </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">__GI___dl_iterate_phdr(), and </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">__GI___dl_iterate_phdr() has its own mutex( lets say DL_MUTEX).</span></div><div><span style="color: #000000; font-family: Calibri,sans-serif;" data-mce-style="color: #000000; font-family: Calibri,sans-serif;" color="#000000" face="Calibri, sans-serif"><span style="font-size:14px">2. lttng_ust_baddr_statedump() calls </span></span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px"> </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">__GI___dl_iterate_phdr() which first takes up DL_MUTEX and then takes the UST_LOCK() in the call back function as </span><span style="color: #000000; font-family: Calibri,sans-serif;" data-mce-style="color: #000000; font-family: Calibri,sans-serif;" color="#000000" face="Calibri, sans-serif"><span style="font-size:14px">extract_soinfo_events()->trace_baddr()->UST_LOCK()</span></span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">.</span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">Since the order is reversed, it can lead to deadlock. To fix this, do you think taking UST_LOCK in </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px"> lttng_ust_baddr_statedump() ( surrounding </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">__GI___dl_iterate_phdr() call ) instead of the call back function is proper ?</span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">In the latest version of UST, I see some changes/refactoring and that the UST_LOCK has been removed from trace_baddr() and moved one call up, but still is being called in the call back function after </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">__GI___dl_iterate_phdr() is called.</span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">Regards,</span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px">Aravind.</span></div></div>
<br>_______________________________________________<br>lttng-dev mailing list<br>lttng-dev@lists.lttng.org<br>https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev<br></blockquote></div><br><div data-marker="__SIG_POST__">-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com</div></div></body></html>