Network Error -1005 Lost Connexion with iOS8

Hello,


It seems our app is getting a lot of Network issues since iOS8, we got many error -1005 Lost connexion.


If iOS 8 receives a HTTP response with a Keep-Alive header, it keeps this connection to re-use later (as it should), but it keeps it for more than the timeout parameter of the Keep-Alive header and then when a second request comes it tries to re-use a connection that has been dropped by the server.

As mentionned here :

http://stackoverflow.com/questions/29063803/how-to-disable-keepalive-in-nsurlconnection

and here:

http://stackoverflow.com/questions/30513189/getting-continous-the-operation-couldn-t-be-completed-after-recursive-post-cal


Does anybody got same issue, and have any solution ?


Thanks a lot,

Julien

Yes!

Today, for some odd reason the app seemed to stop working all around.

The nest is all okay, connected to network.

The network is working fine.

The iphones are all working fine.

Can't same the same for the App, Not even logging in. Giving Network Error message after multiple times in multiple devides. 😕

It’s hard to say what’s going on here because there are lots of potential causes for problems like this. I took a look at the articles you linked to and there seems to be a lot of speculation and not much in the way of concrete info. For example, folks say that they’ve reported the bug to Apple but then don’t give the bug number, which makes it hard to track down the report.

I will say that the explanation you quoted sounds overly simplistic to me:

If iOS 8 receives a HTTP response with a Keep-Alive header, it keeps this connection to re-use later (as it should), but it keeps it for more than the timeout parameter of the Keep-Alive header and then when a second request comes it tries to re-use a connection that has been dropped by the server.

That’s because HTTP keep alive timeouts are inherently racy, so the client always has to deal with the possibility that the server might have closed the connection just as it was trying to reuse it for a new request.

I have a couple of suggestions here:

  • Try reproducing the problem with and without HTTPS. HTTPS complicates things, so reproducing the problem with HTTP helps on that front. OTOH, HTTPS protects you from middlebox interference, which is a common cause of weird-arsed NSURL{Session,Connection} problems (especially on WWAN).

  • Grab both a packet trace and CFNetwork diagnostics log to see if either reveal what’s really happening here.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hello Deager, thank you so much for your feedback !


Correct me if i'm wrong you did test our app and you are talking about Coach Guitar right ?

- Did you tried to open a lesson from our shop and is so did you see InApp purchases items prices showing well in your currency devise ?

- Also, di you tried to play a video from our free demos lessons ?

We get many users feedbacks saying the same thing : app does not get anything from the network. It has appeared since we put our API, medias and videos on a CDN, along with iOS 8.3 release, around mi-march.

Any screen captures, logs or any further feedbacks about this weird network issue well wanted !

We have just sent an updated version with a better network detection, along with a stronger (AFNetwork) network framework.

We are goind crazy to resolve this weird network issue he had since 6 months.

Thanks a lot in advance for your time and your precious feedbacks!

Julien

Hello Eskimo!

Thank you for taking time to look at our issue, this is highly appreciated.

We do not use HTTPS, neither our CDN. Charles Proxy we see nothing particular, excepting some rare -1005 Timeout error codes sometimes.

We are expecting on ios9 coming soon , along with an updated version of our network code.

I will share any infos if I get something, in order to help other developers.

Julien

Charles Proxy we see nothing particular, excepting some rare -1005 Timeout error codes sometimes.

Just FYI, Charles Proxy is a great tool but it’s definitely not the right tool for investigating this issue. The error you’re seeing is related to CFNetwork’s HTTP persistent connections support, and that support behaves differently when you’re talking to a proxy compared to talking directly to the origin server.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hello, thanks for sharing this !

Unfortunately, I didn't see anything.


Do you think our network issue on iPhone ( since mid-march to now) could be linked with the recent dicoveryd core network component in iOS8, to be replaced by mDNSResponder in io9 ?

More on this here : http://9to5mac.com/2015/06/10/ios-9-os-x-10-11-discoveryd-mdnsresponder-network-bugs/


Thanks a lot !

Do you think our network issue on iPhone ( since mid-march to now) could be linked with the recent dicoveryd core network component in iOS8, to be replaced by mDNSResponder in io9 ?

That seems unlikely. I won’t say that these components are not involved in NSURL{Session,Connection} networking, but their involvement is limited to DNS resolution and a DNS resolution failure is unlikely to manifest as a

NSURLErrorNetworkConnectionLost
error.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

In iOS10 ,we use https, also find this problem.

I recently published a QA& about this, namely QA1941 Handling “The network connection was lost” Errors. Given that this error is a fact of networking life, you need to implement the remediation described in the Q&A regardless of what else you do.

If you’re getting an excessive number of these errors, it’s likely that you’re looking at a bug in either NSURLSession or your server. On the NSURLSession side, there’s at least one iOS 10 bug that causes this (r. 28762259). That’s reported as fixed in the latest iOS 10.3 beta, so you should try testing with that.

After that you’ll need to look at the on-the-wire behaviour to see whether the problem is caused by the client or the server. To do this you’ll need to be familiar with both packet traces and CFNetwork diagnostic logging. If you’re convinced that this is a client-side problem, please do file a bug report about that. It would help if you included a small test project that reproduces the issue along with a packet trace and CFNetwork diagnostic log of the problem as it occurs.

If you do file a bug, please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Network Error -1005 Lost Connexion with iOS8
 
 
Q