2019.4 : UnityWebRequest sporadically stops working on iOS

We recently upgraded our game from 2019.3.10f1 to 2019.4.11f1. Since doing so, we’ve noticed that on iOS our game’s network connection has been a little flaky. We haven’t been able to nail down an exact repro, but it seems like all network traffic using UnityWebRequest just stops: our game code continues making HTTP requests but the requests never complete. We have the timeout for requests set to 30 seconds, but the timeout does not seem to be triggering: even after waiting several minutes the timeout is never triggered. It’s as if UnityWebRequest just stops responding all together. It may be related to backgrounding or sleeping the app. It’s not a 100% repro, but I have noticed that switching away from the game to another app, or letting the game go idle and the phone sleep can cause the issue when the game returns. I wonder if it could be caused by the game being paused while a web request is in progress?

I think I have managed to isolate the problem to UnityWebRequest. Our game uses UnityWebRequest to talk to our own services. Our game also uses the AWS S3 SDK and the MapBox SDK, and under the hood these both use UnityWebRequest as well. When this issue occurs, none of these three are able to get any HTTP traffic out. After we discovered this issue, I rewrote the code that talks to our services to use System.Net.Http.HttpClient instead of UnityWebRequest. After this rewrite, when the bug repros, we can talk to our own services, but the AWS S3 SDK and MapBox SDK remain unable to communicate. So, the issue does seem isolated to UnityWebRequest, rather than a blanket shutdown of HTTP traffic for our game.

We’re careful to dispose UnityWebRequests whenever we’re finished with them.

The only other clue I have is some logging that I saw when I managed to reproduce the bug while attached to the game in Xcode, though it could just be a red herring:

[tcp] tcp_output [C40.1:3] flags=[R.] seq=4061060792, ack=1603823876, win=2048 state=CLOSED rcv_nxt=1603823876, snd_una=4061060792
Connection 40: received failure notification
Connection 40: failed to connect 3:-9816, reason -1
Connection 40: encountered error(3:-9816)
[boringssl] boringssl_context_handle_fatal_alert(1763) [C41.1:2][0x1585343e0] read alert, level: fatal, description: inappropriate fallback
[boringssl] boringssl_session_handshake_incomplete(90) [C41.1:2][0x1585343e0] SSL library error
[boringssl] boringssl_session_handshake_error_print(41) [C41.1:2][0x1585343e0] Error: 5454214920:error:1000043e:SSL routines:OPENSSL_internal:TLSV1_ALERT_INAPPROPRIATE_FALLBACK:/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-351.40.2/ssl/tls_record.cc:592:SSL alert number 86
[boringssl] nw_protocol_boringssl_handshake_negotiate_proceed(767) [C41.1:2][0x1585343e0] handshake failed at state 12288: not completed
Connection 41: received failure notification
Connection 41: failed to connect 3:-9860, reason -1
Connection 41: encountered error(3:-9860)
Task <9109C49F-5867-4EA6-9D6B-565AC2B99C42>.<14> HTTP load failed, 0/0 bytes (error code: -1200 [3:-9860])

Beyond this, we haven’t been able to isolate a concrete repro for this issue, and we’re going a little crazy. I’ve read all the known issues for 2019.4 and have checked the issue tracker for UnityWebRequest bugs - none of them describe our issue. Is anyone else seeing similar problems? Does anyone have any tips for how to debug the issue further?

This issue is discussed on other thread. If you can reproduce the issue at a reasonable rate, please report a bug with the repro project.
Thanks.

I will try to isolate a repro, but it’s been difficult. Do you have a link to the other thread, please? I tried searching but have not found anything. Thanks!

This is the other post UnityWebRequests on iOS sometimes get stuck indefinitely even with timeout set - Unity Engine - Unity Discussions, but I’m afraid that there are no clues yet