UnityWebRequest freeze when use it on iOS + local network.

I’m running code that sends a simple GET request at regular intervals.

UnityWebRequest _request;

using (_request = UnityWebRequest.Get(targetUrl))
	_request.timeout = TIMEOUT; 
	await _request.SendWebRequest();

	if (_request.isNetworkError || _request.isHttpError)
		Debug.Log("Scan Network Error");
		Debug.Log("Scan Network Sucess : " + _request.downloadHandler.text);

I encountered the following issue.

  • Happens after launching the app for about 5 hours.
  • But maybe 0.1% UnityWebRequest freezes. There is no response, no timeout error.
  • After more than 5 min, I manually run _request.Abort() , UnityWebRequest returns a timeout error.
  • I encounter this issue about once a day.
  • After this error has occurred, If I send a similar GET request, there is no response and no error will be returned. I should re-boot my app.

My environment is below.

  • Unity 2019.2.6f1
  • iPad Pro 12.9 (third generation)
  • iOS 13.1

I think this freeze happens every 5 hours after launching the app.

It’s nothing related to the number of requests.