# Unity 5.3. iOS. Application hangs. WWW deadlock when loading a texture

**URL:** https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936
**Category:** Mobile
**Tags:** iOS
**Created:** [December 14, 2015, 2:33pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936 "2015-12-14T14:33:35Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [December 14, 2015, 2:33pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/1 "2015-12-14T14:33:35Z")

</div>

After update to Unity 5.3 We’ve got a deadlock on iOS.  
WWW class works fine for simple http requests. But there is a deadlock during loading a texture with WWW class. Probably it’s happens because I manually call Dispose().  
Here is a call stack:  
 ![](https://europe1.discourse-cdn.com/unity/original/4X/c/0/7/c07e25034687886cf0368e3fdb0961cfb7be1595.png)

---

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [December 15, 2015, 11:53am UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/2 "2015-12-15T11:53:37Z")

</div>

Confirmed. This is definitely happens because of calling Dispose in WWW.

---

<div class="post-metadata">

### Author: ![povilas](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/povilas/32/44175_2.png) [@povilas](https://discussions.unity.com/u/povilas)
#### Post date: [December 15, 2015, 2:32pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/3 "2015-12-15T14:32:19Z")

</div>

> [@Andrey Postelzhuk](#):
>
> After update to Unity 5.3 We’ve got a deadlock on iOS.  
> WWW class works fine for simple http requests. But there is a deadlock during loading a texture with WWW class. Probably it’s happens because I manually call Dispose().

Hi, could you submit a bug report and attache a simple reproduction project to it? Please post the bug number here. Thanks!

---

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [December 15, 2015, 3:02pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/4 "2015-12-15T15:02:10Z")

</div>

> [@povilas](#):
>
> Hi, could you submit a bug report and attache a simple reproduction project to it? Please post the bug number here. Thanks!

Hi. This is my first bug report that I’ve created yesterday: 753977\_lioosj0cg583a8uk

This is bug report that I’ve just created with steps to reproduce and test project: 754382\_6haafsmbq3l2kdfk

---

<div class="post-metadata">

### Author: ![povilas](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/povilas/32/44175_2.png) [@povilas](https://discussions.unity.com/u/povilas)
#### Post date: [December 15, 2015, 3:43pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/5 "2015-12-15T15:43:31Z")

</div>

> [@Andrey Postelzhuk](#):
>
> Hi. This is my first bug report that I’ve created yesterday: [https://fogbugz.unity3d.com/default.asp?753977\_lioosj0cg583a8uk](https://fogbugz.unity3d.com/default.asp?753977_lioosj0cg583a8uk)
> 
> This is bug report that I’ve just created with steps to reproduce and test project: [https://fogbugz.unity3d.com/default.asp?754382\_6haafsmbq3l2kdfk](https://fogbugz.unity3d.com/default.asp?754382_6haafsmbq3l2kdfk)

Thanks, we are looking into this.

Could you perhaps remove full links to the bugs and leave only the numbers? Full links allow anyone to view full bug history and attachments.

---

<div class="post-metadata">

### Author: ![christophergoy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/christophergoy/32/937395_2.png) [@christophergoy](https://discussions.unity.com/u/christophergoy)
#### Post date: [December 16, 2015, 7:58pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/6 "2015-12-16T19:58:12Z")

</div>

Hello Andrey,  
We recently made some changes to the WWW class that should fix this deadlock that will be release in the first patch release of 5.3. I tested out your project today and I was unable to get a deadlock with these changes. Thanks for submitting your project. Please let us know if you experience this again in the patch release. Thanks.

---

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [December 16, 2015, 8:14pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/7 "2015-12-16T20:14:14Z")

</div>

Thanks Christopher. I’ll install patch release and check it.

---

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [December 22, 2015, 8:29am UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/8 "2015-12-22T08:29:57Z")

</div>

@christophergoy I installed version 5.3.1. Bug is fixed. Thank you.

---

<div class="post-metadata">

### Author: ![XiaoJi](https://avatars.discourse-cdn.com/v4/letter/x/53a042/32.png) [@XiaoJi](https://discussions.unity.com/u/XiaoJi)
#### Post date: [December 31, 2015, 4:20am UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/9 "2015-12-31T04:20:30Z")

</div>

> [@christophergoy](#):
>
> Hello Andrey,  
> We recently made some changes to the WWW class that should fix this deadlock that will be release in the first patch release of 5.3. I tested out your project today and I was unable to get a deadlock with these changes. Thanks for submitting your project. Please let us know if you experience this again in the patch release. Thanks.

i find a new bug is 5.3.1, the ios http can’t work , i revert the WWWconnection.mm.it work.  
is it safe to revert ??

---

<div class="post-metadata">

### Author: ![Elkis](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/elkis/32/427081_2.png) [@Elkis](https://discussions.unity.com/u/Elkis)
#### Post date: [January 3, 2016, 11:47am UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/10 "2016-01-03T11:47:23Z")

</div>

I’m getting exactly the opposite behavior: WWW class worked fine on 5.3.0 and it never returns from yield when loading a texture on 5.3.1f1 or 5.3.1p1

Edit: Just wanted to thank XiaoJi! I wasn’t able to downgrade to 5.3.0 anymore so reverting the wwwconnection.mm file worked as a charm 🙂

---

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [January 3, 2016, 4:24pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/11 "2016-01-03T16:24:01Z")

</div>

@XiaoJi@Elkis Did you report a bug?  
When I reported a bug with example project Unity team fixed it in 24 hours.

---

<div class="post-metadata">

### Author: ![Elkis](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/elkis/32/427081_2.png) [@Elkis](https://discussions.unity.com/u/Elkis)
#### Post date: [January 6, 2016, 9:32am UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/12 "2016-01-06T09:32:10Z")

</div>

Since the project that presented the bug is very big, I tried to replicate the behavior on a new project. I don’t know why but I am unable to reproduce it, WWW class is working fine on new projects.

I guess it might be some other plugin causing this or the fact that I’ve been upgrading this project since 5.2 that is causing this issue.

Anyway, since new projects work fine and I got a workaround for this particular project, I guess all is good 🙂

---

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [January 6, 2016, 12:50pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/13 "2016-01-06T12:50:02Z")

</div>

I wrote new test application for [WWW.Dispose()](http://WWW.Dispose()) and report a bug.  
Deadlock steel exists.  
I’ve tested this script for iOS, android, editor.  
There is a deadlock for iOS.  
Script works with lags (0.5 - 1 seconds) for android.  
And script crashes in editor.

Here are test script:

```csharp
using UnityEngine;
using System.Collections;

public class TestWWW : MonoBehaviour
{

    private WWW mWWW;
    private int mDisposeCounter;
    private int mDisposeThreshold;
    private bool mSuccess;

    private GUILayoutOption mMinWidth;
    private GUILayoutOption mMinHeight;

    void Awake()
    {
        mMinWidth = GUILayout.MinWidth(400);
        mMinHeight = GUILayout.MinHeight(150);
    }
   
    // Update is called once per frame
    void Update()
    {
        if (mWWW != null)
        {
            if (mWWW.isDone)
            {
                mWWW.Dispose();
                mWWW = null;
                mSuccess = true;
            }
            else
            {
                ++mDisposeCounter;
                if (mDisposeCounter > mDisposeThreshold)
                {
                    ++mDisposeThreshold;
                    Debug.Log("Dispose: " + mDisposeCounter);
                    mWWW.Dispose();
                    CreateWWW();
                }
            }
        }
    }

    void OnGUI()
    {
        if (mWWW != null)
        {
            GUILayout.Label(string.Format("In progress: {0}, {1}", mDisposeCounter, mDisposeThreshold), mMinWidth, mMinHeight);
        }
        else
        {
            GUILayout.Label("Success: " + mSuccess, mMinWidth, mMinHeight);
            if (GUILayout.Button("Create Request", mMinWidth, mMinHeight))
            {
                mDisposeThreshold = 0;
                CreateWWW();
                mWWW.Dispose();
                CreateWWW();
            }
        }
    }

    private void CreateWWW()
    {
        mWWW = new WWW("http://google.com");
        mDisposeCounter = 0;
    }
}

```

---

<div class="post-metadata">

### Author: ![christophergoy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/christophergoy/32/937395_2.png) [@christophergoy](https://discussions.unity.com/u/christophergoy)
#### Post date: [January 6, 2016, 8:31pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/14 "2016-01-06T20:31:01Z")

</div>

Hi Andrey,  
I will test your script out. Could you tell me the bug number for this?  
Thanks,  
Chris

---

<div class="post-metadata">

### Author: ![christophergoy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/christophergoy/32/937395_2.png) [@christophergoy](https://discussions.unity.com/u/christophergoy)
#### Post date: [January 6, 2016, 8:38pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/15 "2016-01-06T20:38:36Z")

</div>

Hi Andrey,  
I have confirmed that the deadlock still exists with your script posted… I am currently fixing it. I will update your bug accordingly once you give me the case number.  
Thanks,  
Chris

---

<div class="post-metadata">

### Author: ![Andrey-Postelzhuk](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrey-postelzhuk/32/115399_2.png) [@Andrey-Postelzhuk](https://discussions.unity.com/u/Andrey-Postelzhuk)
#### Post date: [January 6, 2016, 9:03pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/16 "2016-01-06T21:03:58Z")

</div>

Hi, Chis! Thanks for quick reply. The bug number is 759480.

---

<div class="post-metadata">

### Author: ![christophergoy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/christophergoy/32/937395_2.png) [@christophergoy](https://discussions.unity.com/u/christophergoy)
#### Post date: [January 6, 2016, 10:41pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/17 "2016-01-06T22:41:08Z")

</div>

> [@Andrey Postelzhuk](#):
>
> Hi, Chis! Thanks for quick reply. The bug number is 759480.

Great! Thanks.

---

<div class="post-metadata">

### Author: ![christophergoy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/christophergoy/32/937395_2.png) [@christophergoy](https://discussions.unity.com/u/christophergoy)
#### Post date: [January 7, 2016, 10:40pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/18 "2016-01-07T22:40:51Z")

</div>

Hi Andrey,  
I have a fix going through our review process. Once I know which release it will get into, I will notify you here. Thanks again for your repro script, it was helpful in uncovering this.  
Cheers,  
Chris

---

<div class="post-metadata">

### Author: ![wgt\_jimmy](https://avatars.discourse-cdn.com/v4/letter/w/4491bb/32.png) [@wgt\_jimmy](https://discussions.unity.com/u/wgt_jimmy)
#### Post date: [January 14, 2016, 8:19pm UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/19 "2016-01-14T20:19:22Z")

</div>

This did not get into 5.3.1p3, did it?

---

<div class="post-metadata">

### Author: ![christophergoy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/christophergoy/32/937395_2.png) [@christophergoy](https://discussions.unity.com/u/christophergoy)
#### Post date: [January 15, 2016, 12:22am UTC](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936/20 "2016-01-15T00:22:59Z")

</div>

Hi @wgt_jimmy ,  
No unfortunately it did not. I am trying to target the next patch release. I will confirm when I know.  
Thanks,  
Chris

[Next page](https://discussions.unity.com/t/unity-5-3-ios-application-hangs-www-deadlock-when-loading-a-texture/608936.md?page=2)
