Error logs from nw_connection_write_close after iOS app is suspended
Error logs from nw_connection_write_close after iOS app is suspended
- Subject: Error logs from nw_connection_write_close after iOS app is suspended
- From: Jens Alfke <email@hidden>
- Date: Wed, 23 Nov 2016 15:48:49 -0800
I’m seeing some unexpected NSLog output when my iOS app wakes from being suspended, if it was using NSURLSession immediately before it was suspended (but waited for all requests to complete first):
[] nw_connection_write_close 3 Connection is not ready, sending error callback
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
[] nw_connection_write_close 4 Connection is not ready, sending error callback
[] nw_connection_write_close 5 Connection is not ready, sending error callback
[] nw_connection_write_close 6 Connection is not ready, sending error callback
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
The sequence of events here was:
1. App is doing a bunch of HTTP I/O using NSURLSession
2. User locks device (iPhone 6s+)
3. App starts a background task so it can finish it’s I/O
4. As soon as the final HTTP response is received, the app ends the background task
5. OS suspends the app process
6. User unlocks the device, waking up the app process
The log messages are written immediately after the device is unlocked. I’m guessing that the TCP sockets used by NSURLSession got closed when the process was suspended, but NSURLSession didn’t know about it. Could this be a bug in CFNetwork? Or if it’s expected, it would be nice if it didn’t log error messages…
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden