Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

UnityWebRequest custom DownloadHandlerScript crash on iOS.

Discussion in '5.4 Beta' started by fklingler, May 12, 2016.

  1. fklingler

    fklingler

    Joined:
    May 29, 2015
    Posts:
    10
    Hello,

    I'm having crashes on iOS whenever I instantiate a custom DownloadHandlerScript with preallocated buffer.

    I sent a bug report but it has not been reproduced yet, so ou can find the complete project I use to test this here: https://drive.google.com/file/d/0B_WKsIMYzN7yLXFjaFNQNVJxMkU/view?usp=sharing
    But to make it simpler, if anyone has encountered the same problem or could help me, here the relevants parts of my code:

    Code (CSharp):
    1. class FileDownloader : IDisposable
    2. {
    3.   public string Url;
    4.   public string LocalPath;
    5.  
    6.   public UnityWebRequest Request;
    7.  
    8.   byte[] _chunkBuffer;
    9.  
    10.   public FileDownloader(string url, string localPath)
    11.   {
    12.     Url = url;
    13.     LocalPath = localPath;
    14.  
    15.     Request = new UnityWebRequest(url);
    16.  
    17.     _chunkBuffer = new byte[64 * 1024];
    18.  
    19.     Request.downloadHandler = new ChunkDownloadHandler(_chunkBuffer);
    20.   }
    21.  
    22.   // [...]
    23. }
    Code (CSharp):
    1. public class ChunkDownloadHandler : DownloadHandlerScript
    2. {
    3.   // Pre-allocated buffer only
    4.   public ChunkDownloadHandler(byte[] buffer) : base(buffer)
    5.   {
    6.   }
    7.  
    8.   // [...]
    9. }
    I'm getting the EXC_BAD_ACCESS with this stack trace:


    I have reproduced this problem on Unity 5.3.4p5 and Unity 5.4.0b17

    Am I doing something wrong? Has anyone encountered anything like this and figured out a way to fix it?

    Thanks,

    François
     
  2. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    903
    We ran into that too. Unity has reproduced it and fixed it. Will be available in a patch release next week for 5.3. I don't know the status for 5.4.
     
  3. fklingler

    fklingler

    Joined:
    May 29, 2015
    Posts:
    10
    Thanks for this information!

    I looked at the messages you posted, do you talk about this issue : http://forum.unity3d.com/threads/un...-status-and-ios-problems.380647/#post-2614565 ?
    It doesn't seem to be exactly the same problem, you said it only concerned data upload (POST/PUT), and it crashed in a destructor, whereas my problem concerns a constructor, and in my case it happens on a GET request too.
     
  4. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    903
    You're right, but I would bet that your issue is fixed too since I gave them a repro project that was a decent torture test of mixing get and post infinitely.

    If in doubt, file a bug with a repro project for them. It's the only way to definitely move forward.
     
  5. fklingler

    fklingler

    Joined:
    May 29, 2015
    Posts:
    10
    Unity has contacted me and said the bug should be fixed in the next patch release : 5.3.5p3
     
    MrEsquire likes this.