<div dir="ltr"><div><div><div>Hi Philip,<br><br></div>Below link is the debug log which only includes from nice_debug and stun_debug,<br></div>It's from the caller and started from call-setup , ended in the middle of the call.<br></div><div>The result is connectivity checks failed in every channel,<br></div><div>you may see lots of similar logs since I ran total four ICE threads for various kinds of media in the same time.<br></div><div><br></div>For privacy reason, I replace some IP address strings with the following ones in log file,<br><div><div><div>They are:<br>[STUN Server Address]<br>[Remote public IP address]<br>[NAT public IP address]<br><br></div><div><br></div><div>log link:<br><a href="https://docs.google.com/document/d/1wIduDrGqj7jKSb8q6K6eECNv0xW-0miW0D6UZriG2SQ/pub">https://docs.google.com/document/d/1wIduDrGqj7jKSb8q6K6eECNv0xW-0miW0D6UZriG2SQ/pub</a><br><br><br></div><div>Thanks for your help.<br><br><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-12 17:59 GMT+08: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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<span><br>
On Tue, 2016-01-12 at 16:33 +0800, Jack Wang wrote:<br>
> After I tested with the latest libnice from master branch,<br>
> I found that when the caller (Offer) begin negotiation with the<br>
> callee (Answer),<br>
> the caller program then crash due to assertion fail from libnice.<br>
><br>
> And I found the assertion code is add from the commit below:<br>
> <a href="http://cgit.freedesktop.org/libnice/libnice/commit/?id=2eaa8b3277f4f3" rel="noreferrer" target="_blank">http://cgit.freedesktop.org/libnice/libnice/commit/?id=2eaa8b3277f4f3</a><br>
> 9515ff5dc7b512a44fd79e7275<br>
><br>
> For understanding what the old state and new state are at that time,<br>
> I printed them and got <br>
><br>
> old-state = FAILED<br>
> new-state = CONNECTED<br>
><br>
> all the assertion failed so the application terminated.<br>
><br>
> However, if I do ICE with only audio or video channel, that is, with<br>
> only one ICE thread, it works~!<br>
> so maybe my threads have some improper codes that cause interference<br>
> with the others,<br>
> I'll keep tracking!<br>
<br>
</span>I can’t really debug that without a libnice log or access to your code<br>
(preferred). It could be a bug in libnice, but I wouldn’t be able to<br>
fix it without either of the above.<br>
<span><br>
> And now I haven't used the relay candidate yet,<br>
> after current version of the application becomes more stable,<br>
> I'll also test with it.<br>
><br>
> I think ICE can deal with the case that both endpoint are in<br>
> different symmetric NATs , doesn't it?<br>
<br>
</span>Yes, ICE’s solution for symmetric NATs is TURN. At a high level, ICE is<br>
STUN plus TURN, and what you’re using at the moment is just the STUN<br>
part. You need to set a relay server in order to use TURN. So for some<br>
network configurations, I would expect the connection to fail.<br>
<span><br>
> Furthermore, <br>
> I want to print the debug logs in syslog file , not on the terminal<br>
> screen.<br>
> below are the steps, but doesn't work.<br>
<br>
</span>I would just redirect the output of your program:<br>
<br>
my-program-name &> /path/to/log/file.log<br>
<br>
If you want to log everything from your program (including libnice<br>
debug messages) to the syslog, you should install a custom GLib log<br>
handler using g_log_set_default_handler() or g_log_set_handler().<br>
<span><br>
> 1. modify the nice_debug() function<br>
<br>
</span>If you start modifying libnice, you are going to run into<br>
maintainability problems for your software later on, as you will end up<br>
having to port your changes to each new version of libnice, unless you<br>
get them reviewed and committed upstream. :-)<br>
<span><font color="#888888"><br>
Philip<br>
</font></span><div><div><br>
> 2016-01-11 17:29 GMT+08:00 Philip Withnall <<a href="mailto:philip@tecnocode.co.uk" target="_blank">philip@tecnocode.co.uk</a>>:<br>
> > You can do that without source code modifications by passing --<br>
> > enable-<br>
> > compile-warnings=maximum to the configure script. The default is --<br>
> > enable-compile-warnings=error, which enables -Werror.<br>
> ><br>
> > Philip<br>
> ><br>
> > On Mon, 2016-01-11 at 16:30 +0800, Jack Wang wrote:<br>
> > > Well, after I remove -Werror and -Wno-suggest-attribute=format<br>
> > from<br>
> > > LIBNICE_CFLAGS,<br>
> > > `make` works!<br>
> > ><br>
> > > Later I'll report the result back. :P<br>
> > ><br>
> > > 2016-01-11 15:24 GMT+08:00 Jack Wang <<a href="mailto:antirazin@gmail.com" target="_blank">antirazin@gmail.com</a>>:<br>
> > > > Hello Philip,<br>
> > > ><br>
> > > > When I try to do `make` after I configured master version of<br>
> > > > libnice,<br>
> > > > error occurred:<br>
> > > ><br>
> > > > [jack@localhost libnice]$ make<br>
> > > > make all-recursive<br>
> > > > make[1]: Entering directory `/home/jack/Desktop/libnice'<br>
> > > > Making all in stun<br>
> > > > make[2]: Entering directory `/home/jack/Desktop/libnice/stun'<br>
> > > > Making all in .<br>
> > > > make[3]: Entering directory `/home/jack/Desktop/libnice/stun'<br>
> > > > CC stunagent.lo<br>
> > > > CC stunmessage.lo<br>
> > > > stunmessage.c: In function 'stun_message_append_addr':<br>
> > > > stunmessage.c:437:41: error: cast increases required alignment<br>
> > of<br>
> > > > target type [-Werror=cast-align]<br>
> > > > stunmessage.c:447:42: error: cast increases required alignment<br>
> > of<br>
> > > > target type [-Werror=cast-align]<br>
> > > > stunmessage.c: At top level:<br>
> > > > cc1: error: unrecognized command line option "-Wno-suggest-<br>
> > > > attribute=format" [-Werror]<br>
> > > > cc1: all warnings being treated as errors<br>
> > > ><br>
> > > > make[3]: *** [stunmessage.lo] Error 1<br>
> > > > make[3]: Leaving directory `/home/jack/Desktop/libnice/stun'<br>
> > > > make[2]: *** [all-recursive] Error 1<br>
> > > > make[2]: Leaving directory `/home/jack/Desktop/libnice/stun'<br>
> > > > make[1]: *** [all-recursive] Error 1<br>
> > > > make[1]: Leaving directory `/home/jack/Desktop/libnice'<br>
> > > > make: *** [all] Error 2<br>
> > > ><br>
> > > > however, it never occurred in 0.1.13,<br>
> > > > any suggestion for this?? <br>
> > > > btw,the gcc used is ARM structure<br>
> > > ><br>
> > > ><br>
> > > > Thanks.<br>
> > > ><br>
> > > ><br>
> > > > 2016-01-11 5:21 GMT+08:00 Philip Withnall <<a href="mailto:philip@tecnocode.co" target="_blank">philip@tecnocode.co</a>.<br>
> > uk>:<br>
> > > > > Hi,<br>
> > > > ><br>
> > > > > It seems like you have several problems here.<br>
> > > > ><br>
> > > > > On Fri, 2016-01-08 at 14:14 +0800, Jack Wang wrote:<br>
> > > > > > I have to print debug logs in syslog,<br>
> > > > > > can you teach me how to achieve this?<br>
> > > > ><br>
> > > > > In your terminal:<br>
> > > > ><br>
> > > > > export G_MESSAGES_DEBUG=all<br>
> > > > > export NICE_DEBUG=all<br>
> > > > ><br>
> > > > > then run your program. This will print the full libnice debug<br>
> > > > > logs to<br>
> > > > > the terminal.<br>
> > > > ><br>
> > > > > > In a normal way, the state flow should be gathering -><br>
> > > > > connecting -><br>
> > > > > > connected -> ready,<br>
> > > > > > sometimes may be gathering -> connecting -> failed -><br>
> > connected<br>
> > > > > -><br>
> > > > > > ready,<br>
> > > > > > however, it also can be gathering -> connecting -> failed, <br>
> > > > > > which will never be changed to connected state :(<br>
> > > > > ><br>
> > > > > > I use the callback like the one in sample code (ex: sdp-<br>
> > > > > example.c),<br>
> > > > > > when the state changed,<br>
> > > > > > libnice will signal the callback so that I can know the<br>
> > state<br>
> > > > > in my<br>
> > > > > > application.<br>
> > > > > ><br>
> > > > > > I used version of 0.1.13,<br>
> > > > > > and I will try the master later to see what happened . <br>
> > > > ><br>
> > > > > I would suggest trying with master. There have been a couple<br>
> > of<br>
> > > > > fixes<br>
> > > > > since 0.1.13 to do with state handling and signalling.<br>
> > > > ><br>
> > > > > > I'm also wondering if the bug is related to network<br>
> > > > > environment.<br>
> > > > > > If the two ICE endpoints were at the same LAN, the<br>
> > connectivity<br>
> > > > > > checks never fails. <br>
> > > > > > (well.... actually I can't promise this is always right,<br>
> > the<br>
> > > > > reason<br>
> > > > > > why I suppose this because I called over 30 times and it's<br>
> > > > > always OK)<br>
> > > > > > But it failed more frequent (below 10 times or less) when<br>
> > two<br>
> > > > > > endpoints were at different network areas.<br>
> > > > ><br>
> > > > > Almost everything to do with libnice behavioural differences<br>
> > is<br>
> > > > > to do<br>
> > > > > with network environment! Note that ICE negotiation is not<br>
> > > > > guaranteed<br>
> > > > > to succeed in some network environments (for example, between<br>
> > two<br>
> > > > > peers<br>
> > > > > which are each behind a symmetric NAT).<br>
> > > > ><br>
> > > > > Do you have a TURN relay set up?<br>
> > > > ><br>
> > > > > > Btw, I use an array , which is always reused in next call ,<br>
> > to<br>
> > > > > store<br>
> > > > > > ICE agents for several media channels,<br>
> > > > > > so I didn't clear the agent with the g_object_unref in the<br>
> > end<br>
> > > > > like<br>
> > > > > > in examples since I will get an assertion in nice_agent_new<br>
> > > > > when I<br>
> > > > > > make a new call,<br>
> > > > > > I just set the agent to NULL when call hangs up.<br>
> > > > > ><br>
> > > > > > Is this a proper method? or may cause some side effects?<br>
> > > > ><br>
> > > > > If you are setting the NiceAgent pointer to NULL without<br>
> > calling<br>
> > > > > g_object_unref() first, you are leaking the memory from the<br>
> > > > > NiceAgent,<br>
> > > > > plus all the resources (including network ports) which it’s<br>
> > > > > using. This<br>
> > > > > might be contributing to the ICE failures you are seeing, if<br>
> > > > > there are<br>
> > > > > no more forwardable ports left for the new NiceAgent to use.<br>
> > > > ><br>
> > > > > If you are getting an assertion when calling nice_agent_new()<br>
> > > > > after<br>
> > > > > unreffing the old instance, that indicates a bug somewhere –<br>
> > > > > probably<br>
> > > > > somewhere else in your code – which needs investigating.<br>
> > > > ><br>
> > > > > Philip<br>
> > > > ><br>
> > > > > > 2016-01-05 6:05 GMT+08:00 Philip Withnall <philip@tecnocode<br>
> > .co.<br>
> > > > > uk>:<br>
> > > > > > > Can you please provide a debug log from libnice for this?<br>
> > > > > It’s hard<br>
> > > > > > > to<br>
> > > > > > > work out what the problem is otherwise.<br>
> > > > > > ><br>
> > > > > > > Does the component state change to<br>
> > > > > NICE_COMPONENT_STATE_FAILED? If<br>
> > > > > > > you<br>
> > > > > > > wait, does it later change to NICE_COMPONENT_STATE_READY<br>
> > or<br>
> > > > > > > *_CONNECTED? What are you waiting for to know when the<br>
> > > > > connection<br>
> > > > > > > is<br>
> > > > > > > ready?<br>
> > > > > > ><br>
> > > > > > > What version of libnice is this with? 0.1.13, or master?<br>
> > Can<br>
> > > > > you<br>
> > > > > > > try<br>
> > > > > > > with master?<br>
> > > > > > ><br>
> > > > > > > Philip<br>
> > > > > > ><br>
> > > > > > > On Thu, 2015-12-24 at 21:40 +0800, Jack Wang wrote:<br>
> > > > > > > > I also test by using the random ports , which is used<br>
> > > > > originally<br>
> > > > > > > in<br>
> > > > > > > > libnice,<br>
> > > > > > > > and found it also fails sometimes, <br>
> > > > > > > > however, it still can work in some later calls.<br>
> > > > > > > ><br>
> > > > > > > > Keep tracking and testing....:P<br>
> > > > > > > ><br>
> > > > > > > > 2015-12-24 21:20 GMT+08:00 Jack Wang <antirazin@gmail.c<br>
> > om>:<br>
> > > > > > > > > Hi, everyone<br>
> > > > > > > > ><br>
> > > > > > > > > For several media channels (ex: audio,video etc.),<br>
> > > > > > > > > I create ICE agents for each of them,<br>
> > > > > > > > > and each channel I used a fixed port which is a fixed<br>
> > RTP<br>
> > > > > port.<br>
> > > > > > > > ><br>
> > > > > > > > > Then after I did a SIP call to exchange the ICE SDP<br>
> > with<br>
> > > > > the<br>
> > > > > > > > > callee,<br>
> > > > > > > > > I found the one who sent the offer often failed on<br>
> > > > > negotiation<br>
> > > > > > > on<br>
> > > > > > > > > some channels (not the same ones every time), <br>
> > > > > > > > > while the answer one is always OK.<br>
> > > > > > > > > And if failed on the first time, it will always fail<br>
> > in<br>
> > > > > the<br>
> > > > > > > > > following calls.<br>
> > > > > > > > ><br>
> > > > > > > > > The Offer one is behind a symmetric NAT, and the<br>
> > Answer<br>
> > > > > one is<br>
> > > > > > > on<br>
> > > > > > > > > WAN.<br>
> > > > > > > > > I trace the log and found the failed(for negotiation)<br>
> > > > > ones<br>
> > > > > > > always<br>
> > > > > > > > > discover the prflx candidate very late, and cannot be<br>
> > > > > READY<br>
> > > > > > > state<br>
> > > > > > > > > in the end.<br>
> > > > > > > > ><br>
> > > > > > > > > I cannot figure out why this happens,<br>
> > > > > > > > > does it is related to the NAT policy for port<br>
> > > > > forwarding??<br>
> > > > > > > > ><br>
> > > > > > > > ><br>
> > > > > > > > > Thanks in advance :)<br>
> > > > > > > > ><br>
> > > > > > > > ><br>
> > > > > > > > ><br>
> > > > > > > > _______________________________________________<br>
> > > > > > > > nice mailing list<br>
> > > > > > > > <a href="mailto:nice@lists.freedesktop.org" target="_blank">nice@lists.freedesktop.org</a><br>
> > > > > > > > <a href="http://lists.freedesktop.org/mailman/listinfo/nice" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
> > > > > > > _______________________________________________<br>
> > > > > > > nice mailing list<br>
> > > > > > > <a href="mailto:nice@lists.freedesktop.org" target="_blank">nice@lists.freedesktop.org</a><br>
> > > > > > > <a href="http://lists.freedesktop.org/mailman/listinfo/nice" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
> > > > > > ><br>
> > > > ><br>
> > > ><br>
> > </div></div></blockquote></div><br></div></div></div></div></div>