13

I'm developing an app, with a custom communications layer. My helper classes rely on NSURLConnection to handle communications with the backend.

I'm experiencing a random bug, in which requests get sent, but the app gets no response back from our server. Plus, the timeout of NSURLConnection never gets triggered.

Furthermore, when the app gets into this state, Mixpanel (a tracker framework) logs a connectivity error, as well as TestFlight.

If you kill the app, and launch Safari, you're still able to reach google.com.

For the time being, our app doesn't support Multitasking. Yet, we have discovered that TestFlight is forcing the app 'not-to-get-terminated'.

Would it be possible that, due to this side effect of TF library, the app gets into an inconsistent state... in which any outgoing connection fails?.

Did anyone get a problem like this?

Thanks in advance!!

...

As a side note, i'd like to add that the backend has been checked already (hosted on amazon) and everything seems to be just OK.

=======

EDIT:

TestFlight fellows have just confirmed that this bug is caused by their library (i'm having it with TF 1.0 beta release).

  • can you prove on the server side that a response is being sent? – danh Apr 14 '12 at 00:06
  • It's a VERY random bug. I spent 6 hours with Charles Proxy in between, and couldn't trigger it. My only hint, so far, is that Mixpanel AND TestFlight log a connectivity error. – Jorge Leandro Perez Apr 14 '12 at 00:29
  • How are you sending your NSURLConnection, sync or async? Are you calling from the main thread, a background thread or NSOperation, or something else? – Joseph DeCarlo Apr 14 '12 at 00:43
  • 1
    It should be async. (I'm initializing it this way: [[NSURLConnection alloc] initWithRequest:_urlRequest delegate:self startImmediately:YES]). I've got assertions to prevent execution from background threads, just in case. There is no NSOperation. I used to have thread safety code to handle a custom queue (using GCD), but i've read that it's not a good idea... so that's the first test i've done, i've commented out the GCD code. So long short story, main thread, nothing weird.!. THANKS..!! – Jorge Leandro Perez Apr 14 '12 at 05:00
  • Try initiating a connection and immediately pressing the Home button. If the problem is with the background mode, this is the only way to reproduce it. – Costique Apr 14 '12 at 05:33
  • I've been trying to reproduce, again, this bug for two days. So far the app has proven very stable. However, TestFlight seems to use, internally, a NSOperationQueue. It was preventing the app from getting terminated on suspension. I've disabled TF... and... it's really stable. I'll post again, here, and let you know if i find something. Thanks everyone! – Jorge Leandro Perez Apr 14 '12 at 21:17

2 Answers2

8

There is a confirmed bug with the TestFlight SDK (1.0 and older) that results in NSURLConnection never returning any of its asynchronous callbacks (success/timeout error).

erik
  • 96
  • 1
  • Thank you Erik!. Do you remember where you've seen it?. – Jorge Leandro Perez Apr 24 '12 at 00:57
  • Found it!. You know... Apple's forums are under NDA, so i'm not sure if i can or cannot post anything. But i'll just say... find the post with the title 'NSURLConnection randomly stops working until app restart'. I had the exact same problem. Thanks! – Jorge Leandro Perez Apr 24 '12 at 01:30
  • Is there a way to follow the official bug report for this on the TestFlight site? – Shaun Budhram Apr 24 '12 at 08:40
  • Jorge, I think I'm running into the same bug, but I have an additional symptom. It's only on WiFi. If I exit the app, turn on 3G, and return to it, the pending NSURLConnections complete. Do you see this behavior too, or no? – Shaun Budhram Apr 24 '12 at 08:59
  • Sorry, i didn't see that behavior. I suspected that TestFlight was causing some problems, so i removed it from the app. It's been 10 days, and so far, i couldn't reproduce the bug again. – Jorge Leandro Perez Apr 24 '12 at 12:03
  • Regarding TF support... yeah, they have a mail address here: http://help.testflightapp.com/. I've just sent them a mail, asking for confirmation. I'll update this thread as soon as i get an answer back. Thanks! – Jorge Leandro Perez Apr 24 '12 at 12:04
  • WOW, I'm so glad I found this post. I've been tearing my hair out because our app was occasionally losing network connectivity even though every other app on the ipad was working fine. TestFlight live SDK was indeed the problem! Thank you thank you thank you! So glad I caught this before our app got into the app store! – ToddH May 05 '12 at 01:31
  • So glad also, it is crazy that TestFlight did not removed this SDK nor did they sent a mail to their users ! – rnaud May 18 '12 at 02:12
  • 1
    @erik: thank you for the information. Where did you find this information? I cannot find anything at testflight's page describing this. – toucan Aug 01 '12 at 19:27
0

More information about this issue here: https://github.com/AFNetworking/AFNetworking/issues/307, http://blog.applecorelabs.com/2012/05/29/bug-llvm-optimizer-asihttprequest-arc/

toucan
  • 1,465
  • 1
  • 17
  • 31
  • Sorry, this is unrelated to my glitch. I wasn't using AFNetworking. Plus i don't use ARC, since the app was targetted to iOS 4 or higher. – Jorge Leandro Perez Aug 01 '12 at 21:52
  • If you read through the thread at github, not all are using AFNetworking, but still experience the same problem – toucan Aug 02 '12 at 06:07