playMaker

Author Topic: Editor crash in 2018.3.2  (Read 3463 times)

nickfourtimes

  • Playmaker Newbie
  • *
  • Posts: 27
Editor crash in 2018.3.2
« on: January 21, 2019, 01:25:27 PM »
We're experiencing a very frustrating bug – it happens routinely on one computer, but only very rarely on another. What's more, the editor log seems to report a variety of different causes/locations for the crash, though it always seems to be one of three stack traces. It mostly happens when entering or exiting Play mode, but sometimes on quitting the editor as well... so, perhaps when assets/prefabs are being read & written.

Selections of the three types are below:

Type I – Garbage collection
Code: [Select]
(these mono_traverse lines are repeated about a hundred times)
0x00007FFEFD0ABC0A (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:349] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABC0A (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:349] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABBC0 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:337] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABBC0 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:337] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABBC0 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:337] mono_traverse_array
0x00007FFEFD0AC6BA (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:451] mono_unity_liveness_calculation_from_statics
0x00000001408F9639 (Unity) GarbageCollectSharedAssets
0x00000001409A785C (Unity) UnloadUnusedAssetsOperation::IntegrateMainThread
0x00000001409AAECF (Unity) PreloadManager::UpdatePreloadingSingleStep
0x00000001409AB7AA (Unity) PreloadManager::WaitForAllAsyncOperationsToComplete
0x0000000140E6AB6C (Unity) EditorSceneManager::RestoreSceneBackups
0x0000000141329E68 (Unity) PlayerLoopController::ExitPlayMode
0x0000000141335BDA (Unity) PlayerLoopController::SetIsPlaying
0x0000000141338AB2 (Unity) Application::TickTimer
0x0000000141494E2B (Unity) MainMessageLoop
0x0000000141496AC6 (Unity) WinMain
0x0000000142479C5A (Unity) __scrt_common_main_seh
0x00007FFF5B523034 (KERNEL32) BaseThreadInitThunk
0x00007FFF5D793691 (ntdll) RtlUserThreadStart

Type II – AnimationState destructor
Code: [Select]
========== OUTPUTTING STACK TRACE ==================

0x0000000141892449 (Unity) AnimationState::~AnimationState
0x000000014187FA22 (Unity) Animation::ReleaseAnimationStates
0x000000014187E8D2 (Unity) Animation::MainThreadCleanup
0x00000001405AC5A7 (Unity) delete_object_internal_step1
0x00000001408E0765 (Unity) CommitBatchDelete
0x00000001408F839C (Unity) DestroyObjectHighLevel_Internal
0x00000001408F8150 (Unity) DestroyObjectHighLevel
0x000000014097D534 (Unity) DestroyWorldObjects
0x0000000140E6A716 (Unity) EditorSceneManager::RestoreSceneBackups
0x0000000141329BAA (Unity) PlayerLoopController::EnterPlayMode
0x0000000141335BD3 (Unity) PlayerLoopController::SetIsPlaying
0x0000000141338AB2 (Unity) Application::TickTimer
0x0000000141494E2B (Unity) MainMessageLoop
0x0000000141496AC6 (Unity) WinMain
0x0000000142479C5A (Unity) __scrt_common_main_seh
0x00007FFF5B523034 (KERNEL32) BaseThreadInitThunk
0x00007FFF5D793691 (ntdll) RtlUserThreadStart

Type III – GetType
Code: [Select]
========== OUTPUTTING STACK TRACE ==================

0x00007FFEFCFF6751 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\icall.c:5598] ves_icall_System_Reflection_Assembly_GetTypes
0x00000000538B1586 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
0x00000000538B133F (Mono JIT Code) System.Reflection.Assembly:GetTypes ()
0x000000003A646F22 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ReflectionUtils.cs:91] HutongGames.PlayMaker.ReflectionUtils:GetGlobalType (string)
0x0000000000742663 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ActionData.cs:661] HutongGames.PlayMaker.ActionData:GetActionType (string)
0x0000000000740A6B (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ActionData.cs:826] HutongGames.PlayMaker.ActionData:CreateAction (HutongGames.PlayMaker.ActionData/Context,int)
0x0000000000740283 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ActionData.cs:776] HutongGames.PlayMaker.ActionData:LoadActions (HutongGames.PlayMaker.FsmState)
0x000000003A6EFE4B (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:123] HutongGames.PlayMaker.FsmState:LoadActions ()
0x000000000073AFBB (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:1750] HutongGames.PlayMaker.Fsm:InitData ()
0x000000005365D473 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\PlayMakerFSM.cs:891] PlayMakerFSM:OnAfterDeserialize ()
0x00000000535F3798 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFEFD0BBE4B (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FFEFD041E32 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2919] do_runtime_invoke
0x00007FFEFD04AE3F (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2966] mono_runtime_invoke
0x0000000140C007BA (Unity) scripting_method_invoke
0x0000000140BF0D8A (Unity) ScriptingInvocation::Invoke
0x0000000140C08C57 (Unity) InvokeMethod<RemapPPtrTransfer>
0x0000000140BB339F (Unity) TransferScriptingObject<RemapPPtrTransfer>
0x0000000140BB14A0 (Unity) SerializableManagedRefTransfer::Transfer<SerializableManagedRefBackupGenerator>
0x0000000140E26C59 (Unity) CopyProperties
0x0000000140E24C4E (Unity) CloneObjectsForPrefabSave
0x0000000140E24344 (Unity) CloneObjectsForPrefabSave
0x0000000140E2F05F (Unity) SavePrefab
0x0000000141F07D68 (Unity) AssetDatabaseV1::WriteSerializedAsset
0x0000000141F07F5C (Unity) AssetDatabaseV1::WriteSerializedAssets
0x0000000141EB732F (Unity) AssetDatabase::WriteRevertAssets
0x0000000140E6D245 (Unity) EditorSceneManager::ShouldSaveScenesAndAssets
0x0000000140E6C8A7 (Unity) EditorSceneManager::SaveScenes
0x0000000140E64E29 (Unity) EditorSceneManager::FileMenuSave
0x0000000140DDC381 (Unity) FileMenu::Execute
0x00000001412A8ABD (Unity) MenuController::ExecuteMenuItem
0x00000001412A85E5 (Unity) MenuController::ExecuteMainMenuItem
0x00000001422A196D (Unity) EditorApplication_CUSTOM_ExecuteMenuItem
0x000000003B14BD3E (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorApplication:ExecuteMenuItem (string)
0x000000003B14BC0B (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\ShortcutAttributeDiscoveryProvider.cs:140] UnityEditor.ShortcutManagement.MenuItemEntryDiscoveryInfo:<MenuItemEntryDiscoveryInfo>m__0 (UnityEditor.ShortcutManagement.ShortcutArguments)
0x000000003B1465D3 (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\Trigger.cs:115] UnityEditor.ShortcutManagement.Trigger:HandleKeyEvent (UnityEngine.Event,UnityEditor.ShortcutManagement.IContextManager)
0x000000003B144853 (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\ShortcutController.cs:95] UnityEditor.ShortcutManagement.ShortcutController:HandleKeyEvent (UnityEngine.Event)
0x000000003B144623 (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\ShortcutController.cs:32] UnityEditor.ShortcutManagement.ShortcutIntegration:EventHandler ()
0x000000003B1443DD (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\EditorApplication.cs:329] UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()
0x000000005353A855 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
0x00007FFEFD0BBE4B (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FFEFD041E32 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2919] do_runtime_invoke
0x00007FFEFD04AE3F (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2966] mono_runtime_invoke
0x0000000140C007BA (Unity) scripting_method_invoke
0x0000000140BF0D8A (Unity) ScriptingInvocation::Invoke
0x0000000140BEADC5 (Unity) ScriptingInvocation::Invoke<void>
0x00000001401D28E1 (Unity) Scripting::UnityEditor::EditorApplicationProxy::Internal_CallGlobalEventHandler
0x0000000141288A66 (Unity) CallGlobalInputEvent
0x000000014147B955 (Unity) GUIView::ProcessEventMessages
0x00000001414749C9 (Unity) GUIView::GUIViewWndProc
0x00007FFF5CBB6D41 (USER32) CallWindowProcW
0x00007FFF5CBB6713 (USER32) DispatchMessageW
0x0000000141494FCF (Unity) MainMessageLoop
0x0000000141496AC6 (Unity) WinMain
0x0000000142479C5A (Unity) __scrt_common_main_seh
0x00007FFF5B523034 (KERNEL32) BaseThreadInitThunk
0x00007FFF5D793691 (ntdll) RtlUserThreadStart

Because of the irregularity of the error I haven't had much luck tracking down information on it; however, it does seem to occur specifically with PM installed. Talking to some folks at Unity, it seems like they have a bug ticket open with pretty much an identical stack trace. They are able to replicate the bug with the following code, which keeps data at the same address but potentially switching between types at run-time:

Code: [Select]
public class Foo {
    [StructLayout(LayoutKind.Explicit)]
    public struct Crasher {
        public Crasher(int indicator) {
            referenceType = null;
            valueType = 0;
        }

        [FieldOffset(0)] public int valType;
        [FieldOffset(0)] public GameObject refType;

        public static Crasher crash = new Crasher(0);
}

This is apparently done in the name of convenience, but results in the engine throwing an uncaught exception and crashing.

Bit of a long shot, but do any of the above stack traces look familiar, or like something folks have addressed in the past? Does the suggested val/ref type commingling look like something done in the PM internals, which could cause the crash?

Thanks for any insight.
« Last Edit: January 21, 2019, 01:42:02 PM by nickfourtimes »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Editor crash in 2018.3.2
« Reply #1 on: January 22, 2019, 03:09:12 AM »
Hi,

 First time I see this. Is it happening at specific times, like I myself experience a lot of crash when I expand minimize the game widow for example. Do you think there is something you do in the editor that is likely causing this bug you mentioned?

Bye,

 Jean

nickfourtimes

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Editor crash in 2018.3.2
« Reply #2 on: January 22, 2019, 11:34:25 AM »
Hm... I mean I guess it's hard to say, particularly since it happens often on one computer but very rarely on another. As I mentioned it seems to happen on entering or exiting Play mode, or on quitting the editor; possibly it's caused by prefab (de)serialisation.

I'll test a bit more; I know we had a similar spate of crashes when we would have the PM window open. In that case, I think it was a matter of changing our .NET runtime to v4, but we've tried all variants of that in 2018.3 and had no luck. I haven't extended PM that much; maybe about ten custom actions, and those tend to be copies of existing ones, while the corresponding editors are just copy-pasted code from other CustomAction editors.

I did create my own SetPropertyEditor for the basic SetProperty action. It's a bit of a quality-of-life extension: if we use SetProperty on another PlayMakerFSM object, the action itself will show the name of the other FSM (so we know which one it is if we're referencing an object with many FSMs on it); and if it's changing the property on a component, in a GameObject with multiple such components, it'll show the number of the component ("Nth out of M"), so we'll similarly know which component is being affected. Really don't know how this would cause the crash though.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Editor crash in 2018.3.2
« Reply #3 on: January 23, 2019, 12:31:51 AM »
Hi,

Uhm, the SetPropertyEditor could possibly be faulty? Can you pm me with this?

also, if you are able to script, avoid SetProperty, callMethod, invokeMethod, as they use reflections and it's sub optimal in many ways. So always prefer creating proper custom actions.

I can show you how to do this, if you send me one of your class, I'll do an example and you can then make more using that action as a template.


 Bye,

 Jean

nickfourtimes

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Editor crash in 2018.3.2
« Reply #4 on: June 07, 2019, 02:49:22 PM »
We're seeing these crashes again in Unity 2018.4.1f1, PM 1.9.0.p16.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Editor crash in 2018.3.2
« Reply #5 on: June 12, 2019, 07:26:12 AM »
Hi,

 your best bet is to create the necessary custom actions to prevent reflection, which is never the optimal approach.

If is happening for a very specific access or randomly? how much usage to have you make of these actions like SetProperty?

have you ruled out that your SetPropertyEditor is the source of the issue?


Bye,

 Jean