DNS Lookup issue with pjsua_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The problem is definitely withing pj_gethostname blocking in the c gethostname() function. I replaced the "pj_gethostname()->ptr" call at the end of pjsua_create() with just "TESTTESTTEST" and the situation resolved.

The blocking call to gethostname is now being called on a background thread (that is next time pj_gethostname is called, outside of the pjsua_create() call) as once I've called pjsua_create() all the rest of the setup is handled on the background thread.

This can be a killer for iOS as when the app is backgrounded you only get 30 seconds to run, take any more time than this and the OS till forcibly terminate the app.

I've found as long as the main thread remains responsive (that is running its runloop) then any other background threads can be blocked with no ill effects.

Regards,
-- 
Tony Million

On 12 Jan 2011, at 13:08, Joe Meade wrote:

> Hi Tony,
> 
> This sounds a lot like the problem I was having a couple weeks ago with pjsua_start() taking a long time to complete.
> 
> Samuel pointed me right to the solution, which involves changing one line in the pjsip source.
> 
> <clip>
> It seems there are some problem with pj_getaddrinfo on some devices or some network/DNS configurations.
> 
> To fix your issue, you need to modify a little bit pj_gethostip function in sock_common.c
>     - replace line 789 : status = pj_getaddrinfo(af, pj_gethostname(), &count, &ai);
>     - by : status = PJ_ERESOLVE;
> 
> I believe if you use DNS resolution of pjsip, you shouldn't have this issue.
> </clip>
> 
> Hope this does it for you,
> Joe
> 
> On Wed, Jan 12, 2011 at 7:51 AM, Tony Million <tony at bababoo.com> wrote:
> I've been having a problem with a device running my iPhone app locking up. I've traced it back to line 657 of pjsua_core.c.
> 
> The function is:
> 
>   status = pjsip_endpt_create(&pjsua_var.cp.factory,
>                                pj_gethostname()->ptr,
>                                &pjsua_var.endpt);
> 
> basically, the pj_gethostname() call is calling gethostname which is blocking the app for a significant length of time. Is there a reason this is used there or can the string be set to something else?
> 
> Because pjsua_create() has to be called from the main thread it is making the UI of the application unresponsive until it times out, in my app every other call to pjsua is performed on a background thread, so this is not an issue for the Main thread (and thus the UI).
> 
> Regards,
> --
> Tony Million
> 
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> 
> 
> 
> -- 
> Joe Meade
> 434.242.2685
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20110112/285c03b2/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux