<div dir="ltr"><div>Hi Stephan,<br></div><div><br></div><div>Thank you very much for the report, the stack from valgrind was enough to track down the bug. Yes, libnice is safe in a multithread environment, but this was one bug where the mutex was released in the middle of a function call (when emitting the IO callback) and it was not checking if the stream got delete between the moment it unlocked and locked the mutex again.</div>
<div>I've fixed it in my repository but haven't tested it : <a href="https://github.com/kakaroto/libnice/commit/3fc8fce2a4715120abd2d451ad8b99f03f24bcdd">https://github.com/kakaroto/libnice/commit/3fc8fce2a4715120abd2d451ad8b99f03f24bcdd</a></div>
<div><br>Thank you,</div><div>Youness.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 27, 2014 at 10:50 AM, Stephan Thamm <span dir="ltr"><<a href="mailto:thammi@chaossource.net" target="_blank">thammi@chaossource.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
working on my node.js bindings for libnice [0] I came across what I suspect is<br>
a multithreading bug in libnice. I was unable to find a statement about<br>
multithreading support in the documentation, but a mail on this list [1]<br>
stated that the agent API should be safe.<br>
<br>
The error occurs after removing a stream. It seems that code tries to handle<br>
io for the stream after it was removed, which fails when GSList tries to<br>
access the freed memory.<br>
<br>
I was running my application inside valgrind when the error occured. This<br>
might have increased the chances of this bug occuring (everything is very slow<br>
...). The stack traces are attached.<br>
<br>
The bug triggered on Debian with libnice 0.1.5 as well as<br>
0.1.5+rc20140402-0exp1 from Debian Experimental.<br>
<br>
I hope that this information is enough to find the cause of the bug. I tried<br>
looking into the libnice code, but my understanding of the code is not (yet)<br>
good enough.<br>
<br>
[0] <a href="https://github.com/thammi/node-libnice" target="_blank">https://github.com/thammi/node-libnice</a><br>
[1] <a href="http://lists.freedesktop.org/archives/nice/2009-September/000293.html" target="_blank">http://lists.freedesktop.org/archives/nice/2009-September/000293.html</a><br>
<span class="HOEnZb"><font color="#888888">--<br>
So far, farewell<br>
Thammi</font></span><br>_______________________________________________<br>
nice mailing list<br>
<a href="mailto:nice@lists.freedesktop.org">nice@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/nice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
<br></blockquote></div><br></div>