<div dir="ltr"><div>Hello everybody,<br></div>I am adding Jose.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-05-02 0:20 GMT+02:00 Philip Withnall <span dir="ltr"><<a href="mailto:philip@tecnocode.co.uk" target="_blank">philip@tecnocode.co.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you please verify that by:<br>
 1. Running your test program under gdb, breaking on<br>
    g_main_context_unref, and checking that it is actually freed.<br>
 2. Separately, running your test program with gobject-list[1] or the<br>
    environment variable GOBJECT_DEBUG=objects,instance-count set, and<br>
    seeing what objects are left over on exit.<br>
<br>
Sorry I’m asking for so much information, but leaks like this in libnice<br>
depend on a lot of control flow which I have very little chance of<br>
replicating.<br>
<br>
Thanks,<br>
Philip<br>
<br>
[1]: <a href="https://github.com/danni/gobject-list" target="_blank">https://github.com/danni/gobject-list</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, 2015-04-28 at 10:24 +0200, Miguel París Díaz wrote:<br>
> Yes, main contexts are freed<br>
><br>
><br>
> 2015-04-26 18:47 GMT+02:00 Philip Withnall <<a href="mailto:philip@tecnocode.co.uk">philip@tecnocode.co.uk</a>>:<br>
>         Olivier is correct that you shouldn't need to remove the<br>
>         stream if the NiceAgent is finalised. However, the NiceAgent<br>
>         might not be finalised if you have the GMainContext problems I<br>
>         mentioned earlier. Have you verified that all your<br>
>         GMainContexts are freed before exiting?<br>
><br>
>         Philip<br>
><br>
>         On Apr 25, 2015 6:09 PM, "Miguel París Díaz"<br>
>         <<a href="mailto:mparisdiaz@gmail.com">mparisdiaz@gmail.com</a>> wrote:<br>
>                 I supposed it and agree with Olivier, so we can verify<br>
>                 that there are memory leaks into libnice v01.10, isn't<br>
>                 it?<br>
><br>
><br>
>                 2015-04-25 18:48 GMT+02:00 Olivier Crête<br>
>                 <<a href="mailto:olivier.crete@collabora.com">olivier.crete@collabora.com</a>>:<br>
><br>
><br>
>                         On April 25, 2015 11:58:04 AM EDT, "Miguel<br>
>                         París Díaz" <<a href="mailto:mparisdiaz@gmail.com">mparisdiaz@gmail.com</a>> wrote:<br>
>                         >Hello, I am not doing<br>
>                         nice_agent_remove_stream(), it is needed in<br>
>                         >v0.1.10<br>
>                         >even if the NiceAgent is released?<br>
>                         >Moreover, using the same code with v0.1.7<br>
>                         there is not any memory leak<br>
>                         >detected by valgrind.<br>
><br>
>                         It shouldn't be needed.<br>
><br>
>                         Olivier<br>
><br>
><br>
>                         >2015-04-24 11:58 GMT+02:00 Philip Withnall<br>
>                         <<a href="mailto:philip@tecnocode.co.uk">philip@tecnocode.co.uk</a>>:<br>
>                         ><br>
>                         >> Hey,<br>
>                         >><br>
>                         >> On Tue, 2015-04-21 at 19:15 +0200, Miguel<br>
>                         París Díaz wrote:<br>
>                         >> > Hello again,<br>
>                         >> ><br>
>                         >> > I have run valgrind again with debug<br>
>                         symbol and this is the output<br>
>                         >for<br>
>                         >> > libnice v0.1.10:<br>
>                         >><br>
>                         >> Thanks, that is a bit more useful. I have<br>
>                         omitted all but the<br>
>                         >relevant<br>
>                         >> parts below.<br>
>                         >><br>
>                         >> > nice_agent_gather_candidates<br>
>                         >> > ==12303== 688 (80 direct, 608 indirect)<br>
>                         bytes in 2 blocks are<br>
>                         >> > definitely lost in loss record 8,233 of<br>
>                         8,519<br>
>                         >> > ==12303==    by 0xA6A8E1E:<br>
>                         discovery_add_local_host_candidate<br>
>                         >> > (discovery.c:563)<br>
>                         >> > ==12303==    by 0xA69F7C2:<br>
>                         nice_agent_gather_candidates<br>
>                         >(agent.c:2737)<br>
>                         >><br>
>                         >> > ==12303== 528 (208 direct, 320 indirect)<br>
>                         bytes in 2 blocks are<br>
>                         >> > definitely lost in loss record 8,131 of<br>
>                         8,519<br>
>                         >> *snip*<br>
>                         >> > ==12303==    by 0xA6B26F1:<br>
>                         nice_tcp_active_socket_new<br>
>                         >> > (tcp-active.c:106)<br>
>                         >> > ==12303==    by 0xA6A8DFE:<br>
>                         discovery_add_local_host_candidate<br>
>                         >> > (discovery.c:561)<br>
>                         >> > ==12303==    by 0xA69F7C2:<br>
>                         nice_agent_gather_candidates<br>
>                         >(agent.c:2737)<br>
>                         >><br>
>                         >> > nice_agent_add_stream<br>
>                         >> > ==12303== 144 bytes in 2 blocks are<br>
>                         possibly lost in loss record<br>
>                         >7,624<br>
>                         >> > of 8,519<br>
>                         >> *snip*<br>
>                         >> > ==12303==    by 0x792F40B:<br>
>                         g_cancellable_source_new<br>
>                         >> ><br>
>                         (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1)<br>
>                         >> > ==12303==    by 0xA697CB1: component_new<br>
>                         (component.c:150)<br>
>                         >> > ==12303==    by 0xA6A1EDF: stream_new<br>
>                         (stream.c:68)<br>
>                         >> > ==12303==    by 0xA69B49F:<br>
>                         nice_agent_add_stream (agent.c:2361)<br>
>                         >> > ==12303==    by 0xA27F6B5:<br>
>                         kms_webrtc_base_connection_configure<br>
>                         >> > (kmswebrtcbaseconnection.c:35)<br>
>                         >><br>
>                         >> All of these traces look related, but I<br>
>                         cannot fix them without<br>
>                         >checking<br>
>                         >> a few things first. I have fixed a number<br>
>                         of leaks like this before,<br>
>                         >and<br>
>                         >> typically the problem is actually that the<br>
>                         GMainContext still has<br>
>                         >> pending events when it is stopped. This<br>
>                         means one or more GSources<br>
>                         >are<br>
>                         >> kept alive. In libnice, this generally<br>
>                         means an associated GSocket is<br>
>                         >> also kept alive, which is what is leaking<br>
>                         above.<br>
>                         >><br>
>                         >> Are you absolutely sure that:<br>
>                         >>  • your test code is not leaking a<br>
>                         NiceAgent;<br>
>                         >>  • your test code is not leaking a stream<br>
>                         (use<br>
>                         >> nice_agent_remove_stream()); and<br>
>                         >>  • there are no pending events left in your<br>
>                         GMainContexts when they<br>
>                         >are<br>
>                         >> stopped or destroyed (and that they are<br>
>                         actually destroyed).<br>
>                         >><br>
>                         >> > I cannot reproduce the memory leak that I<br>
>                         reported some days ago<br>
>                         >about<br>
>                         >> > g_source_set_dummy_callback. But I have<br>
>                         searched for it into<br>
>                         >libnice<br>
>                         >> > code, and I have found this entries:<br>
>                         >><br>
>                         >> This is related: that also is a GSource<br>
>                         which is not getting freed<br>
>                         >> somewhere.<br>
>                         >><br>
>                         >> Thanks,<br>
>                         >> Philip<br>
>                         >><br>
>                         >> > 2015-04-15 13:08 GMT+02:00 Miguel París<br>
>                         Díaz<br>
>                         ><<a href="mailto:mparisdiaz@gmail.com">mparisdiaz@gmail.com</a>>:<br>
>                         >> >         Yes, you are right, sorry for not<br>
>                         sending a complete<br>
>                         >report.<br>
>                         >> ><br>
>                         >> >         I will do it when I can and send<br>
>                         the report again ;).<br>
>                         >> ><br>
>                         >> ><br>
>                         >> >         2015-04-13 16:32 GMT+02:00 Philip<br>
>                         Withnall<br>
>                         >> >         <<a href="mailto:philip@tecnocode.co.uk">philip@tecnocode.co.uk</a>>:<br>
>                         >> >                 Hi,<br>
>                         >> ><br>
>                         >> >                 On Mon, 2015-04-13 at<br>
>                         13:10 +0200, Miguel París<br>
>                         >Díaz<br>
>                         >> >                 wrote:<br>
>                         >> >                 > Hello,<br>
>                         >> >                 ><br>
>                         >> >                 > I have tested my system<br>
>                         with valgrind and I have<br>
>                         >> >                 seen some memory<br>
>                         >> >                 > leaks into libnice<br>
>                         v0.1.10.<br>
>                         >> >                 > Valgind does not detect<br>
>                         any memory leak running<br>
>                         >the<br>
>                         >> >                 same tests with<br>
>                         >> >                 > v0.1.7.<br>
>                         >> >                 ><br>
>                         >> >                 > I hope this can help<br>
>                         you to fix them ;).<br>
>                         >> ><br>
>                         >> >                 Not really, without the<br>
>                         necessary debug symbols<br>
>                         >> >                 (replacing the ‘???’<br>
>                         >> >                 entries in the stack<br>
>                         traces below).<br>
>                         >> ><br>
>                         >> >                 Can you please install<br>
>                         the debug info package for<br>
>                         >your<br>
>                         >> >                 distribution for<br>
>                         >> >                 libnice, or recompile it<br>
>                         with debug symbols<br>
>                         >enabled;<br>
>                         >> >                 then produce a new<br>
>                         >> >                 set of leak traces with<br>
>                         valgrind?<br>
>                         >> ><br>
>                         >> >                 Thanks,<br>
>                         >> >                 Philip<br>
>                         >> ><br>
>                         >> ><br>
>                         >> ><br>
>                         >> ><br>
>                         >> ><br>
>                         >> >         --<br>
>                         >> >         Miguel París Díaz<br>
>                         >> ><br>
>                         >><br>
>                         >------------------------------------------------------------------------<br>
>                         >> >         Computer/Software engineer.<br>
>                         >> >         Researcher and architect in<br>
>                         <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br>
>                         >> >         <a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>
>                         >> ><br>
>                         >><br>
>                         >------------------------------------------------------------------------<br>
>                         >> ><br>
>                         >> ><br>
>                         >> ><br>
>                         >> ><br>
>                         >> > --<br>
>                         >> > Miguel París Díaz<br>
>                         >> ><br>
>                         >------------------------------------------------------------------------<br>
>                         >> > Computer/Software engineer.<br>
>                         >> > Researcher and architect in<br>
>                         <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br>
>                         >> > <a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>
>                         >> ><br>
>                         >------------------------------------------------------------------------<br>
>                         >> ><br>
>                         >><br>
>                         >><br>
><br>
>                         --<br>
><br>
>                         Olivier Crête<br>
>                         <a href="mailto:olivier.crete@collabora.com">olivier.crete@collabora.com</a><br>
><br>
><br>
><br>
>                 --<br>
>                 Miguel París Díaz<br>
>                 ------------------------------------------------------------------------<br>
>                 Computer/Software engineer.<br>
>                 Researcher and architect in <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br>
>                 <a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>
>                 ------------------------------------------------------------------------<br>
><br>
><br>
><br>
><br>
> --<br>
> Miguel París Díaz<br>
> ------------------------------------------------------------------------<br>
> Computer/Software engineer.<br>
> Researcher and architect in <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br>
> <a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>
> ------------------------------------------------------------------------<br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">Miguel París Díaz<br>------------------------------------------------------------------------<br>Computer/Software engineer.<br>Researcher and architect in <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br><a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>------------------------------------------------------------------------<br></div></div>
</div>