Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ioq_select Attempting to replace UDP socket when iphone is locked #257

Closed
asrafarifin78 opened this issue Sep 30, 2013 · 19 comments
Closed

Comments

@asrafarifin78
Copy link

Hi,

-I'm using XMPPFramework for chat messaging on IOS.

-I have problem when application waking more than 15 times in 300 seconds when iphone is locked.

-The application can only run on the background only if the iphone is not locked.

-Base on the log I found this message:
ioq_select Attempting to replace UDP socket 9
ioq_select UDP has been replaced successfully!

-It seems that iphone reset the connection opened by XMPPFramework.
-Does XMPPFramework support application running on the background while iphone is locked?

Appreciate if anyone can help on this.

Regards,

@ObjColumnist
Copy link
Collaborator

The XMPPFramework uses TCP/TLS so the log messages regarding UDP is from something unrelated, but as a side note the VoIP Socket APIs only work with TCP/TLS and not UDP.

Although the XMPPFramework does support keeping a persistent socket open in the background (XMPPStream has the property enableBackgroundingOnSocket) you will have to throttle the number of packets sent from the server to get around the 15 wakes in 300 seconds issue.

@asrafarifin78
Copy link
Author

Hi,

-How do I know my connection is purely TCP/TLS?

-I got the message when I received presence from buddies within 5 minutes more than 15 times,and on that time the iphone was locked.That is why I suspect the problem is because connection XMPP framework was reset by kernel.

-How to avoid that happen?

-Here are some parts of my xmpp connection.
xmppStream = [[XMPPStream alloc] init]
xmppStream.enableBackgroundingOnSocket = YES;
[xmppStream setHostName:MY_XMPP_HOST];
[xmppStream setHostPort:MY_XMPP_PORT];
[xmppStream setAutoStartTLS:YES];
[xmppStream setKeepAliveInterval:600.0];
allowSelfSignedCertificates = YES;
allowSSLHostNameMismatch = NO;

Appreciate if you can assist me on this problem.

Thanks.

@ObjColumnist
Copy link
Collaborator

Unless you have modified the XMPPFramework it will be using TCP/TLS.

Like I said before, you will need to throttle the amount of data the server sends to the client, there is nothing you can do on the client side to stop the server sending you too many packets.

@asrafarifin78
Copy link
Author

Hi,

-Just to let you know,I use XMPPFramework only for messaging.

-But I still set enableBackgroundingOnSocket to true to enable it running background.

-For your information, iPhone reset the connection of UDP every time XMPPFramework got data on didReceiveIQ,didReceivePresence when the iphone is locked.

-I also wonder,why it is UDP connection is reset, because as far as I know,the connection made by me is TCP/TLS.

-I need to double check with you,by default,what kind of connection made either TCP or UDP.

-One more thing,as you said above I can only set as TCP if I made some modification on the framework.

-Can you guide me,to that?is there a lot of work to do that,because I'm running of time.

I'm very appreciate for your help.

Thank you

@ObjColumnist
Copy link
Collaborator

I think you misread:

Unless you have modified the XMPPFramework it will be using TCP/TLS.

The XMPPFramework uses TCP.

@asrafarifin78
Copy link
Author

OO..ic,sorry, I really did not notice that,

-So why when there is incoming message to XMPP framework from my server,I got message '"ioq_select attempting to replace UDP socket" ?

-Can you help me to trace that,I just want to make sure it is not XMPP socket whose iPhone reset.

Thank you for your help,I'm really appreciate that

@ObjColumnist
Copy link
Collaborator

A quick Google seems to indicate that message is from PJSIP, are you using that?

Im guessing your app is woken up by the XMPP, at which point PJSIP has an invalid socket as the app has been suspended.

@asrafarifin78
Copy link
Author

-Yes I'm using PJSIP for call part.

-But for keepalive part , I set every 10 minutes to send re-registering to SIP server.

-The problem that I'm concerning now,it happen base on incoming presence message from jabber server.

-It also happen if the client gets ping every time when the screen is locked.

Thank you for your help.I'm looking foward to your reply.

@ObjColumnist
Copy link
Collaborator

Are you using TCP/TLS in PJSIP?

@asrafarifin78
Copy link
Author

-Yes I'm using TCP/TLS in PJSIP.

@ObjColumnist
Copy link
Collaborator

I think the UDP logs might have nothing to do with it then and simply your app is being terminated (and therefore not running in the background) as it is being awoken too many times.

@asrafarifin78
Copy link
Author

Hi,

-From my observation it being awoken too many times after it reach 15 times.

-From the log it shows UDP socket has been replaced 15 times.

-so can you suggest me how to troubeshoot XMPPFramework to double check it is not because of XMPPFramework socket connection?

-One more thing, I need your help how to adjust XMPPFramework so that once the 3G network is restored,it is automatically reconnect immediately.

-I noticed sometime it reconnect after 10 minutes network restored.

-Sometime I noticed the reconnect thread has been stopped.

-Im appreciate if you can help me on this matters

Thank you

@ObjColumnist
Copy link
Collaborator

Your app is only woken up for inbound traffic and connection changes so if you are receiving presence while your app is in the background, it is probably is the XMPPFramework Socket.

@asrafarifin78
Copy link
Author

-Do you have any ideas to avoid this?

Please give me some guides on this problem

Thank you

@ObjColumnist
Copy link
Collaborator

You will need to modify the server to throttle the packets while you are in the background, unfortunately I have not seen any opensource implementations.

@asrafarifin78
Copy link
Author

Do you know how to get "ioq_select Attempting to replace UDP socket" message from XMPPFramework?

I try to throttle the packets base on that message.

On the XMPPFramework,there is no error or any function called when that message appear.

i'm looking to your reply and help.

thank you

@jonasman
Copy link

jonasman commented Oct 5, 2013

No idea :(

@ObjColumnist
Copy link
Collaborator

Like I said its from PJSIP, it is from ioqueue_select.c

The inbound XMPP Traffic is waking the device up, but the error is from PJSIP.

@asrafarifin78
Copy link
Author

You are right,

after I remove pjsip module,the message disappear

TQVM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants