iOS UDP/DNS issue, background/foreground crash

GA
Gert Andreas
Sun, Jan 14, 2018 5:22 PM

hey
i’m working on an iOS app (iOS 11.2) with CallKit and PushKit that started with pjsip 2.7 and i recently upgraded to 2.7.1.
i have several issues here. so any help is highly appreciated.

since the app is using pushkit and connecting to a udp server is set PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0. i first did this in xcode in the preprocessor macros. but since i’m not building the library with the app but separately i guess that didn’t really had the desired effect. but as i said. maybe i got something wrong so feel free to give some advice here.

on startup as well as on connection changes i configure the pj_dns_resolver with the dns entries of the current connection and the standard google dns 8.8.8.8 and 8.8.4.4. all works well for some time but at some point the client is unable to connect reregister. (happens much faster when changing the cellular network cell.. like walking two blocks away. at least it seems like that) console output is as follows:

ioq_select  Error replacing socket: Invalid argument

followed be a nice loop of: udp0x13ff4b6d0  Warning: pj_ioqueue_recvfrom: [err 120009] Bad file descriptor
then i get something like: sip_transport.c  Error processing 74 bytes packet from UDP 8.8.8.8:53 : PJSIP syntax error exception when parsing 'Request Line' header on line 1 col 1: (same for the other DNSs)

then: tsx0x14382d4a8  Failed to send Request msg REGISTER/cseq=61739 (tdta0x1438668a8)! err=70009 (Operation timed out (PJ_ETIMEDOUT))
pjsua_acc.c  ..SIP registration failed, status=503 (Operation timed out (PJ_ETIMEDOUT))
pjsua_acc.c !.Unable to create/send REGISTER: Object is busy (PJSIP_EBUSY) [status=171001]

and ultimately

ioq_select  Error replacing socket: Invalid argument
tsx0x10c811ca8  .Failed to send Request msg REGISTER/cseq=38540 (tdta0x10b009ca8)! err=320046 (No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS))
pjsua_acc.c  ...SIP registration failed, status=503 (No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS))

at least this worked somehow. but then i figured that setting PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0 should have been done in the config_site.h if i’m right. so done that.. compiled the library.
now i have the issue that when i switch the app between foreground and background everything ‘seems’ to be fine. but once i send the app to background, lock the device, unlock it again and trying to send the app to foreground again it crashes.

what i see in the console in case i do this with the debugger attached is

pjsua_acc.c  Error sending keep-alive packet: Broken pipe [status=120032]
followed by an endless loop of
udp0x102b42740  Warning: pj_ioqueue_recvfrom: [err 120057] Socket is not connected

as i said. maybe i’m getting something essentially wrong so any help is highly appreciated. if anyone needs more information feel free to ask and i happily provide them.

thank you,
gert

hey i’m working on an iOS app (iOS 11.2) with CallKit and PushKit that started with pjsip 2.7 and i recently upgraded to 2.7.1. i have several issues here. so any help is highly appreciated. since the app is using pushkit and connecting to a udp server is set PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0. i first did this in xcode in the preprocessor macros. but since i’m not building the library with the app but separately i guess that didn’t really had the desired effect. but as i said. maybe i got something wrong so feel free to give some advice here. on startup as well as on connection changes i configure the pj_dns_resolver with the dns entries of the current connection and the standard google dns 8.8.8.8 and 8.8.4.4. all works well for some time but at some point the client is unable to connect reregister. (happens much faster when changing the cellular network cell.. like walking two blocks away. at least it seems like that) console output is as follows: ioq_select Error replacing socket: Invalid argument followed be a nice loop of: udp0x13ff4b6d0 Warning: pj_ioqueue_recvfrom: [err 120009] Bad file descriptor then i get something like: sip_transport.c Error processing 74 bytes packet from UDP 8.8.8.8:53 : PJSIP syntax error exception when parsing 'Request Line' header on line 1 col 1: (same for the other DNSs) then: tsx0x14382d4a8 Failed to send Request msg REGISTER/cseq=61739 (tdta0x1438668a8)! err=70009 (Operation timed out (PJ_ETIMEDOUT)) pjsua_acc.c ..SIP registration failed, status=503 (Operation timed out (PJ_ETIMEDOUT)) pjsua_acc.c !.Unable to create/send REGISTER: Object is busy (PJSIP_EBUSY) [status=171001] and ultimately ioq_select Error replacing socket: Invalid argument tsx0x10c811ca8 .Failed to send Request msg REGISTER/cseq=38540 (tdta0x10b009ca8)! err=320046 (No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS)) pjsua_acc.c ...SIP registration failed, status=503 (No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS)) at least this worked somehow. but then i figured that setting PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0 should have been done in the config_site.h if i’m right. so done that.. compiled the library. now i have the issue that when i switch the app between foreground and background everything ‘seems’ to be fine. but once i send the app to background, lock the device, unlock it again and trying to send the app to foreground again it crashes. what i see in the console in case i do this with the debugger attached is pjsua_acc.c Error sending keep-alive packet: Broken pipe [status=120032] followed by an endless loop of udp0x102b42740 Warning: pj_ioqueue_recvfrom: [err 120057] Socket is not connected as i said. maybe i’m getting something essentially wrong so any help is highly appreciated. if anyone needs more information feel free to ask and i happily provide them. thank you, gert
SM
s.marek@avm.de
Mon, Jan 15, 2018 9:33 AM

Hi Gert,

try these settings in your config_site.h:

PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT 1
PJ_ACTIVESOCK_TCP_IPHONE_OS_BG 0

Good luck,
Sebastian.

"pjsip" pjsip-bounces@lists.pjsip.org schrieb am 14.01.2018 18:22:50:

Von: Gert Andreas gert@14hoch2.net
An: pjsip@lists.pjsip.org
Datum: 14.01.2018 18:23
Betreff: [pjsip] iOS UDP/DNS issue, background/foreground crash
Gesendet von: "pjsip" pjsip-bounces@lists.pjsip.org

hey
i’m working on an iOS app (iOS 11.2) with CallKit and PushKit that
started with pjsip 2.7 and i recently upgraded to 2.7.1.
i have several issues here. so any help is highly appreciated.

since the app is using pushkit and connecting to a udp server is set
PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0. i first did this in
xcode in the preprocessor macros. but since i’m not building the
library with the app but separately i guess that didn’t really had
the desired effect. but as i said. maybe i got something wrong so
feel free to give some advice here.

on startup as well as on connection changes i configure the
pj_dns_resolver with the dns entries of the current connection and
the standard google dns 8.8.8.8 and 8.8.4.4. all works well for some
time but at some point the client is unable to connect reregister.
(happens much faster when changing the cellular network cell.. like
walking two blocks away. at least it seems like that) console output
is as follows:

ioq_select  Error replacing socket: Invalid argument

followed be a nice loop of: udp0x13ff4b6d0  Warning:
pj_ioqueue_recvfrom: [err 120009] Bad file descriptor
then i get something like: sip_transport.c  Error processing 74
bytes packet from UDP 8.8.8.8:53 : PJSIP syntax error exception when
parsing 'Request Line' header on line 1 col 1: (same for the other DNSs)

then: tsx0x14382d4a8  Failed to send Request msg REGISTER/cseq=61739
(tdta0x1438668a8)! err=70009 (Operation timed out (PJ_ETIMEDOUT))
pjsua_acc.c  ..SIP registration failed, status=503 (Operation timed
out (PJ_ETIMEDOUT))
pjsua_acc.c !.Unable to create/send REGISTER: Object is busy
(PJSIP_EBUSY) [status=171001]

and ultimately

ioq_select  Error replacing socket: Invalid argument
tsx0x10c811ca8  .Failed to send Request msg REGISTER/cseq=38540
(tdta0x10b009ca8)! err=320046 (No working DNS nameserver
(PJLIB_UTIL_EDNSNOWORKINGNS))
pjsua_acc.c  ...SIP registration failed, status=503 (No working DNS
nameserver (PJLIB_UTIL_EDNSNOWORKINGNS))

at least this worked somehow. but then i figured that setting
PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0 should have been done in
the config_site.h if i’m right. so done that.. compiled the library.
now i have the issue that when i switch the app between foreground
and background everything ‘seems’ to be fine. but once i send the
app to background, lock the device, unlock it again and trying to
send the app to foreground again it crashes.

what i see in the console in case i do this with the debugger attached

is

pjsua_acc.c  Error sending keep-alive packet: Broken pipe

[status=120032]

followed by an endless loop of
udp0x102b42740  Warning: pj_ioqueue_recvfrom: [err 120057] Socket is
not connected

as i said. maybe i’m getting something essentially wrong so any help
is highly appreciated. if anyone needs more information feel free to
ask and i happily provide them.

thank you,
gert


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Gert, try these settings in your config_site.h: PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT 1 PJ_ACTIVESOCK_TCP_IPHONE_OS_BG 0 Good luck, Sebastian. "pjsip" <pjsip-bounces@lists.pjsip.org> schrieb am 14.01.2018 18:22:50: > Von: Gert Andreas <gert@14hoch2.net> > An: pjsip@lists.pjsip.org > Datum: 14.01.2018 18:23 > Betreff: [pjsip] iOS UDP/DNS issue, background/foreground crash > Gesendet von: "pjsip" <pjsip-bounces@lists.pjsip.org> > > hey > i’m working on an iOS app (iOS 11.2) with CallKit and PushKit that > started with pjsip 2.7 and i recently upgraded to 2.7.1. > i have several issues here. so any help is highly appreciated. > > since the app is using pushkit and connecting to a udp server is set > PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0. i first did this in > xcode in the preprocessor macros. but since i’m not building the > library with the app but separately i guess that didn’t really had > the desired effect. but as i said. maybe i got something wrong so > feel free to give some advice here. > > on startup as well as on connection changes i configure the > pj_dns_resolver with the dns entries of the current connection and > the standard google dns 8.8.8.8 and 8.8.4.4. all works well for some > time but at some point the client is unable to connect reregister. > (happens much faster when changing the cellular network cell.. like > walking two blocks away. at least it seems like that) console output > is as follows: > > ioq_select Error replacing socket: Invalid argument > > followed be a nice loop of: udp0x13ff4b6d0 Warning: > pj_ioqueue_recvfrom: [err 120009] Bad file descriptor > then i get something like: sip_transport.c Error processing 74 > bytes packet from UDP 8.8.8.8:53 : PJSIP syntax error exception when > parsing 'Request Line' header on line 1 col 1: (same for the other DNSs) > > then: tsx0x14382d4a8 Failed to send Request msg REGISTER/cseq=61739 > (tdta0x1438668a8)! err=70009 (Operation timed out (PJ_ETIMEDOUT)) > pjsua_acc.c ..SIP registration failed, status=503 (Operation timed > out (PJ_ETIMEDOUT)) > pjsua_acc.c !.Unable to create/send REGISTER: Object is busy > (PJSIP_EBUSY) [status=171001] > > and ultimately > > ioq_select Error replacing socket: Invalid argument > tsx0x10c811ca8 .Failed to send Request msg REGISTER/cseq=38540 > (tdta0x10b009ca8)! err=320046 (No working DNS nameserver > (PJLIB_UTIL_EDNSNOWORKINGNS)) > pjsua_acc.c ...SIP registration failed, status=503 (No working DNS > nameserver (PJLIB_UTIL_EDNSNOWORKINGNS)) > > at least this worked somehow. but then i figured that setting > PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT to 0 should have been done in > the config_site.h if i’m right. so done that.. compiled the library. > now i have the issue that when i switch the app between foreground > and background everything ‘seems’ to be fine. but once i send the > app to background, lock the device, unlock it again and trying to > send the app to foreground again it crashes. > > what i see in the console in case i do this with the debugger attached is > > pjsua_acc.c Error sending keep-alive packet: Broken pipe [status=120032] > followed by an endless loop of > udp0x102b42740 Warning: pj_ioqueue_recvfrom: [err 120057] Socket is > not connected > > as i said. maybe i’m getting something essentially wrong so any help > is highly appreciated. if anyone needs more information feel free to > ask and i happily provide them. > > thank you, > gert > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org