Using the latest Unity 2020.1.14f1 and iOS 14.2 unitywebrequests sometimes seem to get ‘stuck’ indefinitely, even with the timeout set to a low number (stuck meaning the ‘isDone’ property never returns true).
Here’s a test case, this will sometimes keep printing “Awaiting request” indefinitely, eventhough the timeout is set to 5:
Can you somewhat reliably reproduce it, or is it a failure in the wild?
You can try adding some additional logging in UnityWebRequest.mm file for additional info gathering.
UnityURLRequest is an implementation of NSMutableURLRequest, so I’m guessing it uses that underlying logic to handle timeouts on the basis of the value set in c#.
So, reading into the the timeoutInterval property of the URLRequest it says this:
The "idle
interval" is defined as the period of time that has passed since the
last instance of load activity occurred for a request that is in the
process of loading. Hence, when an instance of load activity occurs
(e.g. bytes are received from the network for a request), the idle
interval for a request is reset to 0.
This indicates the timeout resets when any kind of activity occurs.
We have our own internal timeout tracking as well, but it relies on activity from that Objective-C code (calling one of the callbacks).
When timeout happens I believe didCompleteWithError should be called.
What you experience is a symptom of Obj-C side finishing but not calling back to Unity.
If you can reproduce this reliably, please report a bug with repro project.
same, it’s kinda random, sometimes it works, sometimes it takes forever to return with timeout, even though we explicitly set the timeout to 10 seconds
Same here… we’re having the EXACT same issue (only on 14.2, hard to reproduce, no timeout, no isDone status). We get it more often on the iPhoneX.
We’ve created our own time-out process so that, when we don’t have a UnityWebRequest.isDone we try to resend the UnityWebRequest. But once it’s broken… it’s broken for good.
We’re experiencing the same issue with UnityWebRequest calls in our app, on iOS 14. Similar errors in our log as others have reported. Also tried to implement on own timeout if we see that the connection stalls, but re-trying the request produces the same failure.
OK OK OK, thats the question: Are you all using AR Foundation!? I’ve replicated that, seems! Closing ArFoundation and reopening it. Now I have to understand if is my fault(some code error) or not.
May it be the right way?