Smart-Inspector icon indicating copy to clipboard operation
Smart-Inspector copied to clipboard

New update seems to have caused issues on Linux 2021.1.9f1 editor. Crashes and closes editor right away.

Open MostHated opened this issue 3 years ago • 48 comments

Hey there, I created a test project a few weeks ago, whenever this was first released, it was using 2021.1.7f1 at the time and I pulled the new changes into the project and went to start it up, but as soon as the editor first loads after the initial Unity splash/loading image, the editor simply closes, or gives a bug report window. I removed the asset from my assets folder and started Unity again to be sure and it loaded just fine. I put the Smart-Inspector folder back in the project and as it was importing/compiling it just locked up. I forced the project closed, tried to open again, and once again it crashed. The below is an excerpt from the tail end of the logs, though, it doesn't seem too helpful, unfortunately.

---- Edit, I added another bit from a log that looks like it has some more info that is relevant to the patcher, not sure if it is related, but it came up just before it locked up again.

Tail end of logs
 

Unloading 308 unused Assets to reduce memory usage. Loaded Objects now: 4304.
Total: 4.445728 ms (FindLiveObjects: 0.162896 ms CreateObjectMapping: 0.088576 ms MarkObjects: 3.713755 ms  DeleteObjects: 0.479810 ms)

ProgressiveSceneManager::Cancel()
[MODES] ModeService[none].Initialize
[MODES] ModeService[none].LoadModes
[MODES] Loading mode Default (0) for mode-current-id-Test_Project
[LAYOUT] About to load Library/CurrentLayout-default.dwlt, keepMainWindow=False
Unhandled description string [
Unhandled description string ]
Unhandled description string \
[MODES] ModeService[default].InitializeCurrentMode
[MODES] ModeService[default].RaiseModeChanged(default, default)
[MODES] ModeService[default].UpdateModeMenus
Unhandled description string [
Unhandled description string ]
Unhandled description string \
IsTimeToCheckForNewEditor: Update time 1624411204 current 1624408549
[Project] Loading completed in 11.095 seconds
	Project init time: 				0.273 seconds
		Template init time: 		0.000 seconds
		Package Manager init time: 		0.000 seconds
		Asset Database init time: 		0.000 seconds
		Global illumination init time: 	0.000 seconds
		Assemblies load time: 			0.000 seconds
		Unity extensions init time: 	0.000 seconds
		Asset Database refresh time: 	0.000 seconds
	Scene opening time: 			2.838 seconds
Unhandled description string [
Unhandled description string ]
Unhandled description string \
Unhandled description string [
Unhandled description string ]
Unhandled description string \
Caught fatal signal - signo:11 code:128 errno:0 addr:(nil)
Obtained 12 stack frames.
#0  0x007f630425cbb0 in funlockfile
#1  0x007f63040d27d9 in psiginfo
#2  0x007f6304185d3b in __printf_chk
#3  0x007f61241c7e56 in mono_breakpoint_clean_code
#4  0x00000041977308 in (Unknown)
#5  0x00000040f43dac in System.InvalidCastException:.ctor ()
#6  0x007f61240d5be5 in mono_print_method_from_ip
#7  0x007f61242459fc in mono_perfcounter_foreach
#8  0x007f61242491c1 in mono_object_unbox
#9  0x007f6124202c2b in mono_exception_from_token
#10 0x007f61241c73ac in mono_breakpoint_clean_code
#11 0x00000041978fa3 in (Unknown)
Launching bug reporter
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QObject(0x1ebc4c0), parent's thread is QThread(0x1557630), current thread is Thread(0x18016d0)
Additional Logs
 
41359000-41369000 rwxp 00000000 00:00 0 
41bd2000-41be2000 rwxp 00000000 00:00 0 
55e3bdf17000-55e3bfce0000 r--p 00000000 103:05 6704642                   /home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity
55e3bfce0000-55e3c316a000 r-xp 01dc9000 103:05 6704642                   /home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity
55e3c316a000-55e3c3270000 r--p 05253000 103:05 6704642                   /home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity
55e3c3270000-55e3c32bc000 rw-p 05359000 103:05 6704642                   /home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity
55e3c32bc000-55e3c3560000 rw-p 00000000 00:00 0 
55e3c4c5f000-55e3cec26000 rw-p 00000000 00:00 0                          [heap]
7f167487f000-7f167ac49000 r--p 00000000 103:05 6704584                   /home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity_s.debug
7f1680000000-7f1680108000 rw-p 00000000 00:00 0 
7f1680108000-7f1684000000 ---p 00000000 00:00 0 
7f16875ff000-7f1687600000 ---p 00000000 00:00 0 
7f1687600000-7f1687e00000 rw-p 00000000 00:00 0 
7f1688000000-7f1688021000 rw-p 00000000 00:00 0 
7f1688021000-7f168c000000 ---p 00000000 00:00 0 
7f168c000000-7f168c02a000 rw-p 00000000 00:00 0 
7f168c02a000-7f1690000000 ---p 00000000 00:00 0 
7f1690000000-7f1690021000 rw-p 00000000 00:00 0 
# ------ A while lot more of the above - cut because it was hundreds/ possibly thousands of lines
# -----------------------------------------------------------------------------------------------

Native stacktrace:

	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Data/MonoBleedingEdge/MonoEmbedRuntime/libmonobdwgc-2.0.so(+0xd809c) [0x7f175415309c]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Data/MonoBleedingEdge/MonoEmbedRuntime/libmonobdwgc-2.0.so(+0x5be3f) [0x7f17540d6e3f]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x14bb0) [0x7f195db52bb0]
	/lib/x86_64-linux-gnu/libpthread.so.0(pthread_mutex_lock+0x4) [0x7f195db49824]
	/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.31(+0xda98a9) [0x7f1822e518a9]
	/lib/x86_64-linux-gnu/libGLX_nvidia.so.0(+0x7a267) [0x7f184452b267]
	/lib/x86_64-linux-gnu/libc.so.6(+0x91f30) [0x7f195d9e5f30]
	/lib/x86_64-linux-gnu/libc.so.6(__libc_fork+0x24) [0x7f195da32924]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity(+0x384061d) [0x55e3c175761d]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity(+0x383f335) [0x55e3c1756335]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity(+0x2ac1794) [0x55e3c09d8794]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x14bb0) [0x7f195db52bb0]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity(+0x24af9d8) [0x55e3c03c69d8]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity(+0x2deb6c4) [0x55e3c0d026c4]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity(+0x2deb5c1) [0x55e3c0d025c1]
	/home/mosthated/Unity/Hub/Editor/2021.1.9f1/Editor/Unity(+0x4965b94) [0x55e3c287cb94]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x9590) [0x7f195db47590]
	/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f195da6d223]

Debug info from gdb:

mono_gdb_render_native_backtraces not supported on this platform, unable to find gdb or lldb
Obtained 9 stack frames.
#0  0x0055e3c08b7773 in profiling::Profiler::InitializeUserThread(char const*, char const*)
#1  0x0055e3c0a017a3 in profiling::gc_finalizer_start(void*)
#2  0x007f1754257482 in mono_profiler_set_iomap_report_callback
#3  0x007f175428f9a4 in mono_callspec_cleanup
#4  0x007f1754260cea in mono_threads_set_shutting_down
#5  0x007f17542c2d1b in GC_inner_start_routine
#6  0x007f17542b7851 in GC_call_with_stack_base
#7  0x007f195db47590 in start_thread
#8  0x007f195da6d223 in clone
Launching bug reporter

Thanks, -MH ------------------------------------

MostHated avatar Jun 23 '21 00:06 MostHated

So it always crashes the Editor on launch now? Was it not happening in previous versions? I remember getting one occasional crash that was somehow related to ActiveEditorTracker, but couldn't get it now - it causes freezes without crash or log

neon-age avatar Jun 23 '21 00:06 neon-age

Wait what? It dies on "Patcher.GUISkinHasLoaded()"?

neon-age avatar Jun 23 '21 00:06 neon-age

It looks like it, everything else before that point is pretty typical Unity stuff. This is from just above the Patcher lines from the log. I can try closing and reopening a few more times to see if I see anything different.

Application.AssetDatabase Initial Script Refresh End
Application.AssetDatabase.Refresh Start
Refresh completed in 0.250891 seconds.
RefreshInfo: RefreshV2(ForceSynchronousImport) scanfilter:
RefreshProfiler: Total: 249.835ms
Application.AssetDatabase.Refresh End
RefreshInfo: StopAssetImportingV2(ForceSynchronousImport) scanfilter:
RefreshProfiler: Total: 1.802ms
Refresh completed in 0.258507 seconds.
RefreshInfo: RefreshV2(NoUpdateAssetOptions) scanfilter:
RefreshProfiler: Total: 257.750ms
Launched and connected shader compiler UnityShaderCompiler after 0.01 seconds
Initializing Unity extensions:
Refresh completed in 0.155609 seconds.
RefreshInfo: RefreshV2(NoUpdateAssetOptions) scanfilter:
RefreshProfiler: Total: 154.427ms
UpdateMenuTitleForLanguage: 10
Unloading 273 Unused Serialized files (Serialized files now loaded: 0)
System memory in use before: 113.9 MB.
System memory in use after: 113.4 MB.

Unloading 308 unused Assets to reduce memory usage. Loaded Objects now: 4282.
Total: 4.346984 ms (FindLiveObjects: 0.150812 ms CreateObjectMapping: 0.087814 ms MarkObjects: 3.629738 ms  DeleteObjects: 0.478066 ms)

ProgressiveSceneManager::Cancel()
[MODES] ModeService[none].Initialize
[MODES] ModeService[none].LoadModes
[MODES] Loading mode Default (0) for mode-current-id-Test_Project
[LAYOUT] About to load Library/CurrentLayout-default.dwlt, keepMainWindow=False
Unhandled description string [
Unhandled description string ]
Unhandled description string \
[MODES] ModeService[default].InitializeCurrentMode
[MODES] ModeService[default].RaiseModeChanged(default, default)
[MODES] ModeService[default].UpdateModeMenus
Unhandled description string [
Unhandled description string ]
Unhandled description string \
IsTimeToCheckForNewEditor: Update time 1624411204 current 1624409192
[Project] Loading completed in 16.321 seconds
	Project init time: 				0.151 seconds
		Template init time: 		0.000 seconds
		Package Manager init time: 		0.000 seconds
		Asset Database init time: 		0.000 seconds
		Global illumination init time: 	0.000 seconds
		Assemblies load time: 			0.000 seconds
		Unity extensions init time: 	0.000 seconds
		Asset Database refresh time: 	0.000 seconds
	Scene opening time: 			1.641 seconds
Unhandled description string [
Unhandled description string ]
Unhandled description string \
Unhandled description string [
Unhandled description string ]
Unhandled description string \

NullReferenceException: Object reference not set to an instance of an object
  at AV.Inspector.Patcher.GUISkinHasLoaded () [0x0000d] in /mnt/x/_unity/_test/Test_Project/Assets/Smart-Inspector/Patches/Provider/Patcher.cs:41
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs) (at /home/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)

(Filename: Assets/Smart-Inspector/Patches/Provider/Patcher.cs Line: 41)

MostHated avatar Jun 23 '21 00:06 MostHated

Can you try to comment out line 32 and 33 in Patcher.Init?

neon-age avatar Jun 23 '21 01:06 neon-age

Sure, one sec, I will give it a try.

MostHated avatar Jun 23 '21 01:06 MostHated

Unfortunately, that didn't help. Just to see, I commented out the [InitializeOnLoadMethod] of the Patcher init and it loaded just fine, but then I realized that, that method is probably what handles everything this asset is about, lol.

MostHated avatar Jun 23 '21 01:06 MostHated

You need to comment out the lines related to GUISkin check, not the whole Init :)

neon-age avatar Jun 23 '21 01:06 neon-age

Yeah, I did. I tried commenting 32 and 33 first, but it didn't seem to make a difference. It still closed right away when loading the editor.

MostHated avatar Jun 23 '21 01:06 MostHated

But what error it gives in this case? Couldn't be 41 line now

neon-age avatar Jun 23 '21 01:06 neon-age

I'd need to try to check this issue later on my Manjaro

neon-age avatar Jun 23 '21 01:06 neon-age

This was unfortunately all it gave this last time.

Caught fatal signal - signo:11 code:1 errno:0 addr:0xf893b11
Obtained 2 stack frames.
#0  0x007fc6821a6bb0 in funlockfile
#1  0x00000041f976a7 in (Unknown)
Launching bug reporter
Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QObject(0x10029e0), parent's thread is QThread(0xd163d0), current thread is Thread(0xfbee70)

MostHated avatar Jun 23 '21 01:06 MostHated

Looking at how this initializes, I will see if I can remove one of the patches at a time to see which one then allows it to load.

MostHated avatar Jun 23 '21 01:06 MostHated

Yes, it should be related to one of the patches being injected / initialized at a wrong time, as was with #5

neon-age avatar Jun 23 '21 01:06 neon-age

Ok, I changed to the following and I found what looks like the one:


		static void GetPatches()
		{
			if (patches != null) 
				return;
			patches = new List<PatchBase>();

			var patchTypes = TypeCache.GetTypesDerivedFrom(typeof(PatchBase));
			for (var i = 0; i < patchTypes.Count; i++)
			{
				
				if (i == 5) // Skipping: PropertyEditorPatch - Editor loaded when it skipped this one
				{
					Debug.Log($"Skipping: {patchTypes[i].Name}");
					continue;
				}
				
				var type = patchTypes[i];
				if (type.IsAbstract)
					continue;

				var instance = Activator.CreateInstance(type) as PatchBase;
				patches.Add(instance);
			}
		}

MostHated avatar Jun 23 '21 01:06 MostHated

Hooh, we're getting somewhere! What if you comment out OnEnable and OnDisable patches in PropertyEditorPatch? These methods are likely to be called during Editor launch

neon-age avatar Jun 23 '21 01:06 neon-age

I removed the skip, then made this adjustment, but it crashed as it had before.


        protected override IEnumerable<Patch> GetPatches()
        {
            // var onEnable = AccessTools.Method(PropertyEditorRef.type, "OnEnable");
            // var onDisable = AccessTools.Method(PropertyEditorRef.type, "OnDisable");
            
            var rebuildContent = AccessTools.Method(PropertyEditorRef.type, "RebuildContentsContainers");
            var endRebuildContent = AccessTools.Method(PropertyEditorRef.type, "EndRebuildContentContainers");
            
            // yield return new Patch(onEnable, postfix: nameof(OnEnable_));
            // yield return new Patch(onDisable, nameof(_OnDisable));
            
            yield return new Patch(rebuildContent, nameof(_RebuildContentsContainers), nameof(RebuildContentsContainers_));
            #if UNITY_2020_1_OR_NEWER
            yield return new Patch(endRebuildContent, postfix: nameof(EndRebuildContentContainers_));
            #endif
        }

MostHated avatar Jun 23 '21 01:06 MostHated

But it doesn't crash if the rest of these patches / Patch itself is skipped?

neon-age avatar Jun 23 '21 01:06 neon-age

If PropertyEditorPatch is skipped from loading via the method I used prior, the editor loads. If I set everything back to normal, but then in PropertyEditorPatch, I make the changes above, it crashes. Did I comment out the proper parts you were referring to?

MostHated avatar Jun 23 '21 01:06 MostHated

Yes, but wait. It crashes even when Editor is already launched?

neon-age avatar Jun 23 '21 01:06 neon-age

I am not sure, when I made the changes, I closed the editor and reopened it, and it crashed.

MostHated avatar Jun 23 '21 01:06 MostHated

When I launch the project with these changes, it crashes.

MostHated avatar Jun 23 '21 01:06 MostHated

I understand, but could you try to launch skipping PropertyEditorPatch and then comment it back in?

neon-age avatar Jun 23 '21 01:06 neon-age

Should I keep OnEnable and OnDisable commented out, or reenable them first?

MostHated avatar Jun 23 '21 01:06 MostHated

You can just skip the whole patch with yield break;

neon-age avatar Jun 23 '21 01:06 neon-age

Ok, like this?


    internal class PropertyEditorPatch : PatchBase
    {
        protected override IEnumerable<Patch> GetPatches()
        {
            yield break;
            var onEnable = AccessTools.Method(PropertyEditorRef.type, "OnEnable");
            var onDisable = AccessTools.Method(PropertyEditorRef.type, "OnDisable");
            
            var rebuildContent = AccessTools.Method(PropertyEditorRef.type, "RebuildContentsContainers");
            var endRebuildContent = AccessTools.Method(PropertyEditorRef.type, "EndRebuildContentContainers");
            
            yield return new Patch(onEnable, postfix: nameof(OnEnable_));
            yield return new Patch(onDisable, nameof(_OnDisable));
            
            yield return new Patch(rebuildContent, nameof(_RebuildContentsContainers), nameof(RebuildContentsContainers_));
            #if UNITY_2020_1_OR_NEWER
            yield return new Patch(endRebuildContent, postfix: nameof(EndRebuildContentContainers_));
            #endif
        }

MostHated avatar Jun 23 '21 02:06 MostHated

Ok, so with that patch skipped, the editor open, you then want me to remove the skip but keep the yield break; and then recompile?

MostHated avatar Jun 23 '21 02:06 MostHated

No, once it's launched, you need to get patch back in by removing yield break; Btw, using break; makes skipping in GetPatches() for loop redundant

neon-age avatar Jun 23 '21 02:06 neon-age

Ok, so, I removed the skip, removed the yield, and recompiled and it crashed.

MostHated avatar Jun 23 '21 02:06 MostHated

So it cuts down the problem to SmartInspector.OnRebuildContent(). Could you try to comment out RebuildToolbar line? ActiveEditorTracker is used the most in there

neon-age avatar Jun 23 '21 02:06 neon-age

I dont see anything with the name of RebuildToolbar within PropertyEditorPatch?

--- Edit, oh, sorry, did you mean

       void RebuildToolbar()
       {
           toolbar?.Rebuild(this);
       }

in Base/SmartInspector?

MostHated avatar Jun 23 '21 02:06 MostHated