Search Unity

Game rendering freezes randomly at runtime

Discussion in 'Windows' started by ex_mi, Jan 25, 2016.

  1. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I can confirm with Unity 5.4.1patch 2 I just got the issues on Lumia 925
    Testing on Desktop and Xbox I do not believe the issue was produced.
    I'm not sure if this issue is causing some other issues as a result also.
     
  2. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    Finally some good news. I think I have prototype code which fixes the hang. Always hard to tell as the hang is not 100% to reproduce.

    The code change is going a few days to make it tidy and make it cross-platform before I can begin the code review process. In the meantime I will get more testing done to confirm the fix in parallel with getting the code ready for the review process.
     
    Wadjey, VladimirTa and MrEsquire like this.
  3. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    I'm using Unity 5.4.1f1 and I'm still encountering this crash.
    @jaketurner Please take a look at this crash bug also.
     
  4. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    So we looking at patch next week?, and maybe add beta 5.5?
    Thing is I got a game update ready and do not wish to publish to store just yet if this issue causes problems on devices..

    If you can provide more details on the code change u made be good..
     
  5. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    The code change is going to take at least another week to make it tidy and then I can start the review process. As for the change it is all about improving the handling of the situation where the internal job system doesn't end up with any job threads, it just have the main thread.
     
    MaxPirat, VladimirTa and Wadjey like this.
  6. Mgaia-Studio

    Mgaia-Studio

    Joined:
    Jul 22, 2014
    Posts:
    11
    Thanks for the updates, Jake!

    Please let us know if we can get a quick fix here in thread in case the official patch release takes some time to be released after the problem is solved.
     
    VladimirTa likes this.
  7. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Thanks Jake, just want to know when we may get the fix so can plan time. So it was not in 5.4.1patch4 and next week is 5.4.2 release. So will it make it next weeks release or need wait for 5.4.2p1? any idea
     
    Last edited: Oct 6, 2016
    Mgaia-Studio likes this.
  8. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    Hi @JakeTurner,
    I created a bug case about the freezing issue that I'm encountering, I don't know if it's the same as this one or not, please verify it: Case 838969
     
  9. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    Hi just wanted to give you guys more updates.

    The code refactoring is going well. I have finished the first part which is the largest change (ground work) and now adding automated tests to check nothing has broken e.g. it works the same way as it used to.

    Then I can implement the bug fix (hopefully tomorrow) and if all is well start the code review process on Wednesday.

    There is one problem. I am holiday next week for 2 weeks. I will organize someone to cover the code review process and stop the process getting stalled whilst I am on holiday.
     
    VladimirTa and Mgaia-Studio like this.
  10. VladimirTa

    VladimirTa

    Joined:
    Jul 17, 2013
    Posts:
    40
    Good to hear that this bug fixing is going well.
    Have a nice holiday! :D
     
  11. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    Testing still going - one more test to write and then just need to run the tests in a special mode.

    If you are on 5.3.6p2 then I have an experimental fix for the hang (not final code, not final fix).

    If you aren't on 5.3.6p2 please let me know which version from 5.3.6 or 5.4.1 and I might be able to make the experimental fix available on a different version.

    The fix is in the form of new Unity Metro Support installer which would replace your existing install.

    Please DM if you would be interested in verifying the fix works?
     
    VladimirTa and MrEsquire like this.
  12. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Hi Jake,

    Thank you for the updates, somewhat strange you choose old build 5.3.6p2 to test on.
    Anyway today I wait for build 5.4.2 from Unity, is it possible to create a experimental fix installer for 5.4x series.
    No need to rush as I rather you get as much as you can done this week before holiday.
    Then next week can start the testing process..
     
  13. VladimirTa

    VladimirTa

    Joined:
    Jul 17, 2013
    Posts:
    40
    I would like to test this fix!
    This hang is always reproducible in my project.
    I am using Windows Unity 5.4.1p4 64bit.
     
  14. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    I would like to test this fix also!
    I'm using Unity 5.4.1f1
     
  15. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    5.3.6p2 is the build where I had the 100% reproduction case.

    I have a custom build for 5.3.6p2 & 5.4.1f1 - DM if you like to try it.

    I am working to prepare another build for: 5.4.1p1 but I think that is all I can do for now (before I go on holiday).

    I would prefer to get some feedback (hopefully positive results) before making any more builds.

    Jake
     
  16. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    I now have a 5.4.1p1 & 5.4.2f1 build fix.

    Please DM if you want to try it. I have had one positive result so far (1 out of 1) which is encouraging.

    Thanks

    Jake
     
  17. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    If you upgrade to 5.4.2f1 (which is basically identical to 5.4.1p4) then there is a 5.4.2f1 build available
     
  18. VladimirTa

    VladimirTa

    Joined:
    Jul 17, 2013
    Posts:
    40
    Sure!
    Upgrading right now.
     
  19. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Guys I tested using 5.4.2 on mobile and seems to be fine and working.
    But now I have issues with testing on Windows x64 with Unhandled exception.
    Is the application you guys making for Windows Mobile only, please do tests on desktop also..
     
  20. skaarjslayer

    skaarjslayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    I tested using the Unity 5.4.1p1 build fix provided by Jake and couldn't reproduce the issue on Lumia 920 and 925 but on the 620 I still have a freeze occurring every time I try to load a level. I'll continue testing. It could be a different issue I'm having on the 620, it's just strange that it's basically the same issue (screen freeze, music plays in background, ads still refresh, etc.) except that it appears to happen on the 620 everytime I try to load the game's levels (navigating UI appears fine), whereas on the 920 and 925 the freeze would occur anywhere, even in UI.
     
    MrEsquire likes this.
  21. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Do you get any messages in the Visual Studio Debugger when the freeze happens?
     
  22. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    Yes the fix was very specific to Windows Phone and not tested and not really meant to be used on anything else. Making it work for all platforms is what I am still working on now.
     
  23. skaarjslayer

    skaarjslayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    Disregard that. Turned out to be a bug on my end. So far so good, the 620 doesn't seem to have a freeze yet. Will post again if that changes.
     
  24. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    What do you mean make it work all platforms?
    No sure I understand? You mean Windows Store universal or other platforms such as android-ios?
     
  25. Mgaia-Studio

    Mgaia-Studio

    Joined:
    Jul 22, 2014
    Posts:
    11
    I just tested Jake's fix for 5.3.6p2 and everything seems to be working now on my initial tests! No hangs nor freezes so far. I'm testing on a Lumia 930.

    My game build is completely messed up because I tried dozens of different stuff before I knew it was a Unity bug, so I'll get a good build ready and do some more tests now.

    Update: ok I've tested a lot more on my "good build" and no hangs nor freezes happened. Everything ok here!
     
    Last edited: Oct 19, 2016
    MrEsquire likes this.
  26. VladimirTa

    VladimirTa

    Joined:
    Jul 17, 2013
    Posts:
    40
    The fix works on Nokia Lumia 822 Windows Phone 8.1.
    Not a single hang so far.

    Thanks Jake!
     
  27. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Good to hear but is your game target just for mobile or universal application. So supports desktop and xbox etc?
     
  28. VladimirTa

    VladimirTa

    Joined:
    Jul 17, 2013
    Posts:
    40
    Only mobile, Android, iPhone and Windows Phone 8.1
     
    MrEsquire likes this.
  29. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Guess maybe Jake didnt make final update before his holiday...
    Looks like we wait even longer for fix..
     
  30. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    Hi

    Looks like so far the preview build is fixing the problems which is great feedback.

    I have nearly finished the tidied up version of the fix, just starting to run automated tests on its current progress before I do the final (hopefully quick) refactoring.

    Still aiming for 5.4.3 release if I can. A lot of unknowns at play so hard to predict.

    Thanks

    Jake
     
    VladimirTa likes this.
  31. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    Hi,
    The fix was working well on my Lumia 920 and 620, then I decided to update my app using it (Unity 5.4.1f1 + your fix), but now I'm getting a bad reviews from users complaining about crashes :/
    The devices of users who encountering crashes (and gave me a negative rating) are Lumia 930, Lumia 535, Lumia 630, on WP8.1. In their reviews they're saying that the game started crashing just after the update.
     
    Last edited: Oct 21, 2016
    MrEsquire likes this.
  32. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    Hi Jake,
    Here's the log of the crashes caused by the fix:
    BITNESS_MISMATCH_ARM_NULL_CLASS_PTR_READ_NOSOS_c0000005_UnityPlayer.dll!Unknown
    BITNESS_MISMATCH_ARM_HEAP_CORRUPTION_NOSOS_c0000374_heap_corruption!
    BITNESS_MISMATCH_ARM_INVALID_POINTER_READ_NOSOS_c0000005_UnityPlayer.dll!Unknown
    BITNESS_MISMATCH_ARM_HEAP_CORRUPTION_ACTIONABLE_BlockNotBusy_DOUBLE_FREE_NOSOS_c0000374_UnityPlayer.dll!Unknown
    BITNESS_MISMATCH_ARM_EM_WATCHDOG_TIMEOUT_DEADA444_Publisher.GameName_xxxxxxxxxxx!GameName.exe_Quiesce_Hang
     
    MrEsquire likes this.
  33. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Regarding the bitness mismatch:
    We are seeing these errors in the MS backend since October 15th, e.g.:
    BITNESS_MISMATCH_ARM_EM_WATCHDOG_TIMEOUT_DEADA444_ModernAlchemistsOG.3DSniperKillTerrorShooter2_vrs50bw3zqf1m!Sniper_Ops_3D.exe_Task_disconnected_while_still_running:_server_task_currentState_=_Active,_targetState_=_Active.​

    It occurs in old and new packages, all on Windows 8.1
    And others just disappeared (without any update from our side!), e.g.
    EM_WATCHDOG_TIMEOUT_DEADA444_Sniper_Ops_3D.exe!{01E55721-C273-49BB-AD02-2D1FA9FDEC06}_Task_disconnected_while_still_running:_server_task_currentState_=_Active,_targetState_=_Active.​

    This is not the first time I have observed such weird reporting from MS.
    I am not saying, everything's alright, but you have to be careful when reading the MS health reports.
    If you have other apps (and not only Unity apps), you always have to check them aswell ... you might see the same spikes.

    Update: For Win/WP8.1 we use Unity 5.3.3p2 -- my last known stable version regarding the freeze isse.

    Update 2: It also looks like MS just changed the health backend in the last 24hrs ... it looks totally different than yesterday.

    Update 3: Well, I assume the backend data for our account is messed up right now. The graph doesnt represent the values in the list ... disregard the posted info for now, I'll update it as soon as I think the data is OK again.
     
    Last edited: Oct 20, 2016
  34. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    For my app most of these errors are new, after applying the fix the number of Hangs decreased considerably and this is a good sign, but the number of crashes are increased a lot!
     
  35. AlfredL

    AlfredL

    Joined:
    Sep 10, 2013
    Posts:
    27
    Just want to add more info to this issue. We are using 5.4.2f2 to create UWP for our game. And we got consistent repro on this hang issue on Dell Inspiron 11-3168 Signature Edition (2GB RAM), and Lumia 435.

    In addition, if I deploy a debug version to the device, I can also repro the crash issue with "Odd tag in Clean up" message.

    Following is the call stack of Unity thread when the game hangs. One interesting thing that we found is that if we change the project setting to use DX12 if available, the hang issue will disappear on the devices that support DX12 (e.g. Dell Inspiron 11) but still repro on the devices that doesn't support DX12.

    Code (csharp):
    1. UnityPlayer.dll!JobQueue::WaitForJobGroup(JobGroupID gid, bool execMain) Line 1418    C++
    2. UnityPlayer.dll!CompleteFenceInternal(JobFence & fence) Line 27    C++
    3. UnityPlayer.dll!GfxDevice::ExecuteAsync(int count, void(*)(GfxDeviceAsyncCommand::ArgScratch *, const GfxDeviceAsyncCommand::Arg *) func, GfxDeviceAsyncCommand::ArgScratch * * scratches, const GfxDeviceAsyncCommand::Arg * arg, JobFence & depends) Line 1250    C++
    4. UnityPlayer.dll!GfxDeviceClient::ExecuteAsync(int count, void(*)(GfxDeviceAsyncCommand::ArgScratch *, const GfxDeviceAsyncCommand::Arg *) func, GfxDeviceAsyncCommand::ArgScratch * * scratches, const GfxDeviceAsyncCommand::Arg * arg, JobFence & depends) Line 3849    C++
    5. UnityPlayer.dll!ForwardShaderRenderLoop::StartRenderJobs(JobFence & renderPassDataSortFence, bool opaque, ShaderPassContext & passContext) Line 1086    C++
    6. UnityPlayer.dll!ForwardShaderRenderLoop::performRendering(JobFence & renderPassDataSortFence, const ActiveLight * mainDirShadowLight, const ShadowJobData & shadowCullData, bool disableDynamicBatching, bool clearFrameBuffer, bool opaque, Camera::RenderFlag cameraRenderFlag) Line 1136    C++
    7. UnityPlayer.dll!DoForwardShaderRenderLoop(RenderLoopContext & ctx, dynamic_array<RenderObjectData,8> & objects, const CullResults & cullResults, bool opaque, bool disableDynamicBatching, bool clearFrameBuffer, Camera::RenderFlag cameraRenderFlag) Line 1639    C++
    8. UnityPlayer.dll!DoRenderLoop(RenderLoop & loop, RenderingPath renderPath, CullResults & cullResults, ShadowMapCache & shadowCache, bool dontRenderRenderables) Line 460    C++
    9. UnityPlayer.dll!Camera::DoRender(CullResults & cullResults, const SharedRendererScene & sharedRendererScene, Camera::RenderFlag renderFlags, void(*)(Camera &, RenderLoop &, const RenderNodeQueue &) customRender, const RenderNodeQueue * customRenderNodeQueue) Line 1372    C++
    10. UnityPlayer.dll!Camera::Render(CullResults & cullResults, ShaderPassContext & passContext, const CameraRenderingParams * params, Camera::RenderFlag renderFlags) Line 2222    C++
    11. UnityPlayer.dll!RenderManager::RenderCameras(const int displayId) Line 135    C++
    12. UnityPlayer.dll!PlayerRender(bool present) Line 1048    C++
    13. UnityPlayer.dll!PostLateUpdate_FinishFrameRendering() Line 1714    C++
    14. UnityPlayer.dll!PlayerLoop(bool __formal, bool performRendering, IHookEvent * pHookEvt) Line 2160    C++
    15. UnityPlayer.dll!UnityPlayer::AppCallbacks::MetroMainLoop() Line 1183    C++
    16. UnityPlayer.dll!UnityPlayer::AppCallbacks::DoPerformUpdateAndRender() Line 1309    C++
    17. UnityPlayer.dll!UnityPlayer::AppCallbacks::_AppThreadImplementation(void * param) Line 177    C++
    18. UnityPlayer.dll!win32::CreateThread::__l2::<lambda>(Windows::Foundation::IAsyncAction ^ __formal) Line 276    C++
     
    Last edited: Oct 24, 2016
    Wadjey likes this.
  36. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    I would also like to add our 2 ct:
    Is this bug really limited to dual core cpus only?

    We are receiving bug reports, that our game also hangs on e.g. quad cores, such as a Inspiron 3847.

    Edit: Fortunately, we have received more details to the bug reports regarding the Inspiron 3847 ... it's a Dual Core.
     
    Last edited: Oct 25, 2016
  37. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Even though Jake is working on fix, I not seen a clear answer on how this impacts UWP apps and other platforms. At least give a proper explanation, e.g. we found the issue it only effects this and this..
    Otherwise I could be delaying game release for weeks/months at this rate!
     
    mr_zog likes this.
  38. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Update: So I just tried Unity 5.4.2p1 -> Universal Game.
    Yes I know the version does not have the fix included but wanted test results;

    Desktop x64/x32: No game issues or exceptions in Visual Studio.
    XboxOneS: No game issues or exceptions in Visual Studio.

    Phone: Lumia 925: Unhandled exception at 0x5E6DFED3 (UnityPlayer.dll) in Game.exe: 0xC0000005: Access violation reading location 0x00000000.

    So basically if one creates a app now for Windows 10 Universal or Mobile, then it will not work or crash.
    Come on Unity please shed some more light to whats going on here?
     
  39. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Hi,
    reading through the information here and sort of hinted via Unity-support plus the bug reports we receive, sadly, I must say that the issue occurs on desktop PCs aswell. It seems to be limited to DUAL CORE CPUs "though".
    Now, the S***ty thing is, uptil 5.3.3p2, the UWP build is simply a mess and buggy as hell (UI issues, etc). They fixed some stuff afterwards, but introduced this nasty bug in return.

    So you can choose between infinite loop bug and graphical hell ... and that's now so since end of April at least (that's when QA confirmed the bug to us).

    It would be interesting if this bug also occurs on Android dual cores.... but we havent received any reports regarding this.
     
    MrEsquire likes this.
  40. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    That crash sounds unrelated: mind making a new thread about it?
     
  41. matt33315

    matt33315

    Joined:
    Mar 28, 2014
    Posts:
    94
    Hi Jake,

    If this fix is still planned for 5.4.3 do you know when the release will be available?

    Thanks
    Matt
     
    mr_zog likes this.
  42. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    I backwarded my app to Unity 5.3.3p2 (from Unity 5.4.1f1+the fix), and the crashes are almost disappeared for WP8.1 in the Windows Store Dashbord heath report.
    I can confirm that Unity 5.3.3p2 is the most stable version for WP8.1 builds.
    That said, I'm still seeing lot of "hangs" in the the Windows Store Dashbord heath report for WP8.1 devices.
     
    VladimirTa, MrEsquire and mr_zog like this.
  43. AlfredL

    AlfredL

    Joined:
    Sep 10, 2013
    Posts:
    27
    Our UWP release for both Windows 10 PC and Phones is also blocked by this issue. It will be appreciated if Unity can get it fixed as soon as possible.
     
    MrEsquire likes this.
  44. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    My guess 2-3 weeks based by patch release each week..
    And usually there are a few.. not good news..
     
  45. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    Hi

    Just wanted to give you guys an update with good & bad news.

    Bad News
    • The change hasn't finished code review phase yet so still a few weeks away. I am still aiming for 5.4.3 if I can.
    Good News
    • The change is finished and I have run a lot of automated tests on it locally and the tests are now passing, before the changes the tests were failing.
    • The first part of the change is just about to enter code review and start to run the automated tests on the build farm.
    I am currently at Unite which means I can't test on Windows Phone until I am back next week. When I have access to windows phone I will verify the bug is still fixed. At that point I will also make a 5.4.2 build for internal QA testing but I could share that with volunteers if people are interested.
     
    mr_zog and VladimirTa like this.
  46. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Thanks for the update.
    As soon as you got something to test, please ping me. If the patch somehow makes it into a 5.3.x, I would favor that, but we'll have to upgrade to 5.4/5.5 sometime anyway ...
     
  47. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    One more thing: Can you confirm that this bug also affects Windows dual core CPUs and not only Windows Phone?
    Are all platforms affected?
     
  48. axcs

    axcs

    Joined:
    Jan 6, 2015
    Posts:
    17
    Hello I have the same problem just released last week a game to the store, and I began to discover that the game froze on devices with Dual Core (PC and Mobile - Lumias). At first I thought it was something related to DirectX, but now I realize that not.
    I am very surprised how this problem has been going on so long, and there is no warning on the Home page or in a prominent place, this problem is serious, the game was released and already has many negative feebacks and negative reviews, and I without guilt.

    I also want to help and be voluntary in their experimental tests and corrections.
    You can count on my help, but please do not delay much longer :(
    I have Lumia 735 (Quad Core) game works fine, and I have Lumia 925 (Dual Core) game freezing.
     
    Last edited: Nov 6, 2016
    VladimirTa and MrEsquire like this.
  49. JakeTurner

    JakeTurner

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    137
    For UWP platforms it could affect any h/w with 2 or less cores which should include dual cores.

    axcs: if you DM me I can try and supply experimental builds with the fix for you to help with the verification process.
     
    VladimirTa and axcs like this.
  50. axcs

    axcs

    Joined:
    Jan 6, 2015
    Posts:
    17

    Hi, I send you a DM. I am happy to help, and i like to test the experimental builds.
    Please reply for me =)