Search Unity

Downloading Texture: "received no data in response"

Discussion in 'Editor & General Support' started by Samuel411, Dec 2, 2019.

  1. Samuel411

    Samuel411

    Joined:
    Dec 20, 2012
    Posts:
    646
    Hello. I'm having an issue with a user who is reporting an error of, "received no data in response", when trying to download this image for example, https://gamedevhq.com/wp-content/uploads/2019/08/Thumbnail_Template_muzzle-flash-300x252.jpg. This issue isn't exclusive to this image but this is an example of the domain it's under.

    This is an editor plugin and runs in the editor, not in-game.

    Here's the code for the download image method,
    Code (CSharp):
    1. public static async Task<GetTextureResult> GetImage(string url, int parentId, int id)
    2.         {
    3.             try
    4.             {
    5.                 UnityWebRequest request = UnityWebRequestTexture.GetTexture(url);
    6.                 request.SendWebRequest();
    7.                 while (request.isDone == false)
    8.                     await Task.Delay(1);
    9.  
    10.                 if (request.isHttpError || request.isNetworkError || request.downloadHandler == null)
    11.                 {
    12.                     Logging.Log("[NetworkInterface] Errored on GET Image: " + url + ", " + request.error);
    13.                     connected = false;
    14.                     return new GetTextureResult { parentId = parentId, id = id, texture = null };
    15.                 }
    16.                 Texture myTexture = ((DownloadHandlerTexture)request.downloadHandler).texture;
    17.  
    18.                 if (myTexture == null)
    19.                 {
    20.                     Logging.Log("[NetworkInterface] No image found!");
    21.                     connected = false;
    22.                 }
    23.                 request.Dispose();
    24.                 return new GetTextureResult() { parentId = parentId, id = id, texture = myTexture };
    25.             }
    26.             catch(Exception e)
    27.             {
    28.                 return null;
    29.             }
    30.         }
    We have thousands of requests from hundreds of users all using this method and only have had this issue reported two times.

    The first time I was able to resolve it by seeing that the error wasn't being reported until the 70th call in a single frame, which I determined to be some kind of firewall protection on their end and added a delay to spread the requests out in time.

    This time the error is being sent on the first request of the method. I did a teamviewer session with the user and couldn't determine anything that would cause the 4.X API to not be active, and they were using Standalone as their build target. Pinging the server that the images are hosted returned a response, so they are able to connect to our servers. They are using Unity 2019.2.5f1 and the plugin is built as a DLL using the 2018.3.6f1 API.
     
    Last edited: Dec 3, 2019
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    It could be proxy setup on users machine.
    Other than that I have no idea. Best to examine network traffic using tools like Fiddler.
     
  3. 1samuel411

    1samuel411

    Joined:
    Nov 1, 2015
    Posts:
    3
    I will look into this with the user. Thank you for the reply.
     
  4. Samuel411

    Samuel411

    Joined:
    Dec 20, 2012
    Posts:
    646
    I looked at it with the user and used fiddler to collect data on their network traffic on our plugin. I've got the session data posted below, I am pretty confident there isn't any security issues with that data just information about the requests.

    They all seem to check out with valid responses. I tested connection to our server with the port 80 and 443 (HTTP and HTTPS) and even 773 for TCP. All valid requests... I'm genuinely stumped on this.

    Session Data: https://www.dropbox.com/s/vz1fra5mi95uu6d/Test_Result.saz?dl=0
     
  5. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
  6. Samuel411

    Samuel411

    Joined:
    Dec 20, 2012
    Posts:
    646
    The body is returning 0 for some calls, but that matches up what I get in response on my side for some reason.

    The calls are all the calls to GameDevHQ,and checkmyip, and the AWS calls. The AWS and check my ip calls work successfully in Unity by the way it's only the GameDevHQ calls that are failing in Unity.

    The first call in Unity has an error that says, received no data in response. Then the 4 next calls return the error, Unable to complete SSL connection, before the plugin just stops and tells the user they can't connect.

    It should load about 80 calls to get images for the home page, which it did in their fiddler and it did on mine as well.

    The one thing that might be a concern if anything was the requests on his side took about 8 seconds to fully complete when I viewed it from fiddler, but I don't know why it would time out with such a short time and it doesn't mention time outs being the cause of this.

    I'll provide a fiddler archive of my own successful attempt when I'm back home.
     
  7. Samuel411

    Samuel411

    Joined:
    Dec 20, 2012
    Posts:
    646
    Sorry for the wait, here it is
     
  8. Samuel411

    Samuel411

    Joined:
    Dec 20, 2012
    Posts:
    646
    Talked to the user they said using ethernet fixed the issue. I'm not sure what happened but I'm glad its working!