Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. The 2023.1 beta is now available for testing. To find out what's new, have a look at our 2023.1 feature highlights.
    Dismiss Notice

Editor crash - new in RC2

Discussion in '5.4 Beta' started by makeshiftwings, Jul 26, 2016.

  1. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    My game seems to be regularly crashing the editor in playmode now when creating meshes, with the following error:

    m_VB != NULL

    (Filename: C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/VertexBufferD3D11.cpp Line: 98)

    Crash!!!
    ========== OUTPUTING STACK TRACE ==================

    0x00007FFFD742F544 (d3d11) CreateDirect3D11SurfaceFromDXGISurface
    0x0000000140330137 (Unity) GeometryJobTasks::EndGeometryJobFrame
    0x00000001414951BD (Unity) GfxDeviceWorker::RunCommand
    0x000000014149B3AF (Unity) GfxDeviceWorker::Run
    0x000000014149324D (Unity) GfxDeviceWorker::RunGfxDeviceWorker
    0x000000014059DAF8 (Unity) Thread::RunThreadWrapper
    0x00007FFFDA9B8102 (KERNEL32) BaseThreadInitThunk

    ========== END OF STACKTRACE ===========

    Haven't quite figured out a reliable repro so any idea what might be causing it would be good.
     
  2. Alex-Lian

    Alex-Lian

    Guest

    I assume graphics jobs enabled?
     
  3. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    They are not. Should they be?
     
  4. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    I just tried turning them on, and instead of crashing the editor, it freezes the editor. So, not much of a change. ;)
     
  5. Alex-Lian

    Alex-Lian

    Guest

    Hm, ok, different from what I was expecting. The devs related to the graphics threading are away right now, so not sure I even have someone to investigate. Will see who I can point at this.
     
  6. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    Ugh this is happening constantly now, any time I add a mesh in play mode. On the bright side, it only seems to be affecting the editor, and not the actual standalone build.
     
  7. Alex-Lian

    Alex-Lian

    Guest

    A particular mesh or any mesh? Something with a solid repro?
     
  8. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    I submitted a bug (817859) with a few more details. My game has a Minecraft-like block building system. It crashes now when I add a block in play mode, which goes through these basic steps:
    - Instantiate impostor block with a fade-in vertex shader
    - Get the underlying mesh data of every block in the chunk
    - Rebuild a single mesh out of the combined mesh data and assign it to the renderer
    - Rebuild the mesh collider out of this mesh

    One of those steps is causing the crash; not every time but roughly 80% of the time. This was all working fine in 5.3 and 5.4 until RC2; I can't think of any changes on my end that could be causing it. If I have time later I'll try to step through the code and see where exactly it crashes but that could be a while. Thanks for the help though. :)
     
  9. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    @makeshiftwings can you attach actual repro project to your bug report?

    Additionally, check if disabling GPU skinning in player settings fixes the issue. Just found a bug with how we handle GPU skinning when tessellation shaders are present, that confuses some drivers (fixing that one now)... though if you say it's 5.4 RC2 that causes the regression, then maybe that's not very likely.
     
  10. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    GPU Skinning was off. I can't submit my main project because it's gigantic but i'll see if i can get it to repro in an example.
     
  11. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    Sigh... so I'm trying to narrow it down by stepping through my code with the debugger, but having the debugger attached causes a slightly different crash in the editor when adding blocks:

    ========== OUTPUTING STACK TRACE ==================

    0x000000014009EBAF (Unity) CanvasBatchIntermediateRenderer::AddSubBatch
    0x00000001412766A8 (Unity) UI::Canvas::DrawIntermediateRenderer
    0x000000014127685E (Unity) UI::Canvas::EmitWorldGeometry
    0x000000014126B71B (Unity) UI::CanvasManager::EmitWorldGeometry
    0x0000000140E2454A (Unity) RenderGameViewCameras
    0x00000001413C16F4 (Unity) EditorGUIUtility_CUSTOM_INTERNAL_CALL_RenderGameViewCamerasInternal
    0x00000000C93AE5C4 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorGUIUtility:INTERNAL_CALL_RenderGameViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Rect&,UnityEngine.Vector2&,bool)
    0x00000000C93AE47A (Mono JIT Code) [C:\buildslave\unity\build\artifacts\generated\common\editor\EditorGUIUtilityBindings.gen.cs:606] UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Rect,UnityEngine.Vector2,bool)
    0x000000002A4D1EB4 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\GameView\GameView.cs:680] UnityEditor.GameView:OnGUI ()
    0x0000000000977032 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007FFFA878519B (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke
    0x00007FFFA86D84FD (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke
    0x00007FFFA86DE8F7 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:3827] mono_runtime_invoke_array
    0x00007FFFA869CF2F (mono) [c:\buildslave\mono\build\mono\metadata\icall.c:2857] ves_icall_InternalInvoke
    0x0000000000940967 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
    0x000000000093EAC2 (Mono JIT Code) [/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222] System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    0x0000000020474D3F (Mono JIT Code) [/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115] System.Reflection.MethodBase:Invoke (object,object[])
    0x0000000028B4EBD6 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\HostView.cs:187] UnityEditor.HostView:Invoke (string,object)
    0x0000000028B4EAC0 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\HostView.cs:180] UnityEditor.HostView:Invoke (string)
    0x000000002A4B8277 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:355] UnityEditor.DockArea:OnGUI ()
    0x0000000000977032 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007FFFA878519B (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke
    0x00007FFFA86D84FD (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke
    0x00000001404C638B (Unity) ScriptingInvocationNoArgs::Invoke
    0x000000014128D083 (Unity) MonoBehaviourDoGUI
    0x0000000141280250 (Unity) IMGUIModule::MonoBehaviourDoGUI
    0x0000000140344F2A (Unity) MonoBehaviour::DoGUI
    0x0000000140E2D01E (Unity) GUIView::OnInputEvent
    0x0000000140E2E7CA (Unity) GUIView::DoPaint
    0x0000000140E2EBE0 (Unity) GUIView::RepaintAll
    0x0000000140BD4577 (Unity) Application::UpdateScene
    0x0000000140BD5939 (Unity) Application::UpdateSceneIfNeeded
    0x0000000140BDD7F4 (Unity) Application::TickTimer
    0x0000000140E3D63E (Unity) FindMonoBinaryToUse
    0x0000000140E3EC6C (Unity) WinMain
    0x00000001415BC0D0 (Unity) strnlen
    0x00007FFFDA9B8102 (KERNEL32) BaseThreadInitThunk

    ========== END OF STACKTRACE ===========

    Also, I want to reiterate this only seems to be crashing in the editor, not in the standalone build.
     
  12. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    Narrowing it down... I think it's related to destroying a Worldspace UI Canvas.
     
  13. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    So it's definitely related to destroying a gameobject with a Worldspace UI Canvas. I can get it to repro every time in my main project but can't figure out how to get it to repro in a separate project yet... there's something I'm missing. But it looks like somehow deleting the Worldspace Canvas causes some kind of memory corruption, which causes DX11 to throw one of several different errors that crash the editor. The actual error that's thrown seems random because I'm doing the same thing each time. Here's another one:

    ========== OUTPUTING STACK TRACE ==================

    0x000000014032AAEB (Unity) std::_Tree<std::_Tset_traits<TextureID,std::less<TextureID>,stl_allocator<TextureID,57,16>,0> >::_Insert
    0x000000014032AF05 (Unity) std::_Tree<std::_Tset_traits<TextureID,std::less<TextureID>,stl_allocator<TextureID,57,16>,0> >::_Linsert
    0x000000014032B34D (Unity) GfxDeviceStats::AddUsedTexture
    0x000000014146AD98 (Unity) GfxDeviceD3D11Base::SetTextures
    0x000000014032C5E4 (Unity) GpuProgram::ApplyTextureParameters
    0x0000000141463ABB (Unity) D3D11CommonShader::ApplyGpuProgram
    0x0000000141472059 (Unity) GfxDeviceD3D11Base::SetShaderPropertiesCopied
    0x0000000141494DBD (Unity) GfxDeviceWorker::RunCommand
    0x000000014149B3AF (Unity) GfxDeviceWorker::Run
    0x000000014149324D (Unity) GfxDeviceWorker::RunGfxDeviceWorker
    0x000000014059DAF8 (Unity) Thread::RunThreadWrapper
    0x00007FFFDA9B8102 (KERNEL32) BaseThreadInitThunk

    ========== END OF STACKTRACE ===========
     
  14. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    And this always seems to precede all of the different errors:

    m_VB != NULL

    (Filename: C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/VertexBufferD3D11.cpp Line: 98)
     
  15. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    Also, if it helps: it crashes at the point of actually rendering the frame after the Canvas has been deleted. Not when the call to Destroy is first made.
     
  16. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,324
    makeshiftwings likes this.
  17. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    Hahaha perfect timing... I JUST figured out how to repro it and was submitting the bug. Wish I had read that post before wasting this afternoon. :mad:
     
  18. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    New bug number is 818176. I know destroying Worldspace UI's might seem like a corner case to many people, but in my case I do it constantly and this crash makes the editor nearly unusable for me. Pleeeease fix it before the official 5.4 release.
     
  19. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,346
    Damn... you guys released already. Well, hopefully this will get fixed in one of the upcoming patches.
     
  20. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Hey all i can really say for now is we are investigating it. Dont have a exact cause. Keep a eye on your bug / e-mail in case we have more questions.