Race condition in FSNConnection
failWithError: is not designed to be called more than once, but in our case it is sometimes called twice: when the internet connectivity dies, and when UIApplication decides to run 'fireExpirationHandler'.
Presumably, 'endBackgroundTask' should prevent this from happening, but the first time failWithError: is called, 'complete' is enqueued on the run loop, and may be called only after the second call to failWithError:. Hence the race condition.
Thanks for the report; I haven't looked into it but this does sound like a real problem. Ideally failWithError would be idempotent but we have to be careful about the ref-counting semantics, because failWithError can cause the connection instance to be released.