SSL handshake fails when App is terminated and reopened

I'd like some pointers for this specific problem. The scenario is:


- Client: iOS App (targeting iOS 8.0+) using SSL connections (NSURLConnection) to query a custom APO

- Server: Apache2 with mod_ssl, TLSv1.2 enabled, SSLv3 disabled, SSL certificate from Certificate authority


When the app is launched first, the SSL connection to the server is established OK. The Apache's SSL log (TRACE6) shows no errors during the handshake.


But: When the App is terminated by the user (press home button twice, swipe the app screen up to kill it), and then reopenend by tapping it's icon, the connection to the Apache Server is not established correctly - it is "stuck".

The Apache's SSL log shows the following problem: The app's SSL handshake begins normally (like in the above scenario), but hangs at the following message in the Server's log:

OpenSSL: Loop: SSLv3 read client certificate A


which means that the Server is waiting for the client (the app) to send a "certificate A". This never happens, and the Apache's request timeout will abort the SSL connection. The app will then initiate a new connection, but it too will hang at the same point of the handshake. After 5 retries, the app's NSURLConnection terminates with Reachability reporting "the Server isn't reachable". When I retry to establish the connection, it suddenly begins working again, until I terminate the App again. This is reproducable every time the app is started after being terminated.


Another way to make the App establish the Server connection again is to


- delete the App from the iOS device

- redownload the App from the App store

- connection is established on first try


To me it looks like the iPhone / App for some reason seems to not do the SSL handshake again after it has been terminated and reopenend. What could be the culprit for this behaviour? Is it necessary to do cleanup of the connections in applicationWillTerminate?


Thank you for any help.

SSL handshake fails when App is terminated and reopened
 
 
Q