"Unexpected mark stack overflow" when editing

Avatar
  • updated
  • Unity's Fault

I'm getting this error fairly frequently when editing a shape in the inspector. See attached video of thrashing a property in order to trigger it:

https://streamable.com/3pue6t

It doesn't seem to be specifically related to the property I'm playing with in the video, it does seem to happen when editing most things within a Shape. Just to clarify I've not seen this error trigger anywhere else in Unity. Thanks!

Reporting a bug? please specify Unity version:
2021.2.4f1
Reporting a bug? please specify Shapes version:
4.1.1
Reporting a bug? please specify Render Pipeline:
URP
Avatar
Marco M

Have since discovered that this issue doesn't occur in Unity 2020.3.24f.

Avatar
Marco M

Has anyone else experienced this in 2021? I downgraded to 2020 as I rely on Shapes a fair bit, but just wondering whether or not this issue is related to my particular project in some way. Cheers.

Avatar
timm

Yes, I am getting that as well in 2021.2.4f1... I at first didn't attribute it to shapes as I was also doing some extremely heavy vfx graph stuff and I even got one of my scenes into a state in which unity failed to load it. Had to manually disable/delete a lot of scene elements by editing the scene file manually (among which were some shapes elements). Now in a different project it can easily happen when just manually playing around with the color editor (to try out a lot of gradient stuff).

Avatar
devon merner

This crash still exists and is making Shapes completely unusable.  Would really appreciate some response on this.


Info: Unity 2021.2.8 with URP 12.1.3 and Shapes 4.1.1.  OS is Windows 11.

Stack Trace:

0x00007FFCD6C5C496 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\mark.c:1379] GC_push_all
0x00007FFCD69E709B (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\boehm-gc.c:787] mono_push_other_roots
0x00007FFCD6C59B3A (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\mark.c:457] GC_mark_some_inner
0x00007FFCD6C599EB (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\mark.c:522] GC_mark_some
0x00007FFCD6C4D8D7 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\alloc.c:672] GC_collect_a_little_inner
0x00007FFCD6C4BE69 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\alloc.c:1563] GC_allocobj
0x00007FFCD6C54D2F (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\malloc.c:191] GC_generic_malloc_inner
0x00007FFCD6C5489F (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\malloc.c:252] GC_generic_malloc
0x00007FFCD6C58D03 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\external\bdwgc\malloc.c:333] GC_malloc_kind
0x00007FFCD69E73EC (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\boehm-gc.c:944] mono_gc_alloc_obj
0x00007FFCD69564AA (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\object.c:6118] mono_object_new_by_vtable
0x00007FFCD69D706F (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\custom-attrs.c:917] create_custom_attr
0x00007FFCD69D7887 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\custom-attrs.c:1040] create_custom_attr_into_array
0x00007FFCD69D9423 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\custom-attrs.c:1572] mono_custom_attrs_construct_by_type
0x00007FFCD69DB0AB (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\custom-attrs.c:2284] mono_reflection_get_custom_attrs_by_type_handle
0x00007FFCD68A82D6 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\icall-def.h:533] ves_icall_MonoCustomAttrs_GetCustomAttributesInternal_raw
0x00000247800815C0 (Mono JIT Code) (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
0x00000247800811CB (Mono JIT Code) System.MonoCustomAttrs:GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider,System.Type,bool)
0x00000247800800BB (Mono JIT Code) System.MonoCustomAttrs:GetCustomAttributes (System.Reflection.ICustomAttributeProvider,System.Type,bool)
0x0000024787227DDB (Mono JIT Code) System.Reflection.RuntimeFieldInfo:GetCustomAttributes (System.Type,bool)
0x000002454D3AE005 (Mono JIT Code) [C:\-snip-\Shapes\Scripts\Runtime\Utils\ShapesExtensions.cs:182] Shapes.ShapesExtensions:GetDescription (System.Enum)
0x000002454D3ADF33 (Mono JIT Code) [C:\-snip-\Shapes\Scripts\Editor\Utils\ShapesUI.cs:429] Shapes.ShapesUI/<>c__56`1:b__56_3 (System.Reflection.FieldInfo)
0x00000247800FD98E (Mono JIT Code) System.Linq.Enumerable/SelectArrayIterator`2:ToArray ()
0x000002478008B037 (Mono JIT Code) System.Linq.Enumerable:ToArray (System.Collections.Generic.IEnumerable`1)
0x000002454D3ACA5B (Mono JIT Code) [C:\-snip-\Shapes\Scripts\Editor\Utils\ShapesUI.cs:429] Shapes.ShapesUI:SortedEnumPopup (UnityEngine.GUIContent,UnityEditor.SerializedProperty,string[])
0x000002454D3AAF73 (Mono JIT Code) [C:\-snip-\Shapes\Scripts\Editor\Components\ShapeRendererEditor.cs:133] Shapes.ShapeRendererEditor:BeginProperties (bool,bool)
0x000002454D3AA23B (Mono JIT Code) [C:\-snip-\Shapes\Scripts\Editor\Components\RectangleEditor.cs:49] Shapes.RectangleEditor:OnInspectorGUI ()

Avatar
devon merner

Also worth mentioning that my project uses the il2cpp backend with Incremental GC enabled.

I've just disabled Incremental GC as a test, and I haven't seen a crash yet.

Avatar
Freya Holmér creator
  • Unity's Fault

like some of you mention, it seems like it is related to IL2CPP and incremental GC, and there's a possible regression that happened in 2021.2 specifically. I was personally unable to repro this in 2021.1 at least!

Unity thread on it here: https://forum.unity.com/threads/il2cpp-crash-at-malloc.1144004/

Shapes has been working fine prior to 2021.2, so this is likely something Unity messed up on their end, which is out of my control I'm afraid

Avatar
devon merner
Quote from Freya Holmér

like some of you mention, it seems like it is related to IL2CPP and incremental GC, and there's a possible regression that happened in 2021.2 specifically. I was personally unable to repro this in 2021.1 at least!

Unity thread on it here: https://forum.unity.com/threads/il2cpp-crash-at-malloc.1144004/

Shapes has been working fine prior to 2021.2, so this is likely something Unity messed up on their end, which is out of my control I'm afraid

Can you make a bug report on Unity's issue tracker with a repro project?

I'm not exactly sure what specific action is causing the crash in Shapes (something about reading and displaying the values from the serialized object?)  and it's not like we can create a public repro project with the full Shapes asset included.

Avatar
Freya Holmér creator

well, one issue is that I can't reproduce this on my machine, using the same Unity version :c

I've heard it happens when tweaking values in the inspectors, and that it doesn't take very long for it to run out of memory. But my profile is completely fine for a full minute of dragging/changing values on multiple shapes

Avatar
kei

( 2021.2.8.f1) Yup getting the same thing when modifying values in a shapes component in the inspector. Initially when it was happening I thought it was me; Since like Timm I'm messing around with writing other weird shader codes. But I've noticed it only happens when I spend some time changing values back and forth on a shapes object. 
Like you said its probably something on Unity's end just wanted to throw my own confirmation its happening since you can't reproduce it.

Avatar
Marco M

I need to do some more testing but I *think* this issue only occurs for the Rectangle shape, can anyone else confirm this? I did try turning off incremental GC but that didn't help.

Avatar
kei
Quote from Marco M

I need to do some more testing but I *think* this issue only occurs for the Rectangle shape, can anyone else confirm this? I did try turning off incremental GC but that didn't help.

For me it was occurring specifically with the Disk shape, haven't tried to confirm it with other shapes yet.

Avatar
devon merner
Quote from Freya Holmér

well, one issue is that I can't reproduce this on my machine, using the same Unity version :c

I've heard it happens when tweaking values in the inspectors, and that it doesn't take very long for it to run out of memory. But my profile is completely fine for a full minute of dragging/changing values on multiple shapes

Which OS are you running?  I reported a crash for Obi Rope a few years ago that couldn't be reproduced by the developers, and it turned out that they were testing on macOS instead of Windows.

Also, I was only testing the crash on the Rectangle shape.  Haven't tried the others.

Avatar
Max Nielsen

For me the asset has become completely un-usable since Unity 2021.2. Crashes, stack overflows, and so on. It seems to only happen with rectangle shapes.

Avatar
Freya Holmér creator

I'm still unable to replicate this :( even using the rectangle shape

if any if you would be able to debug this I'd be very grateful! I'd start by looking at the profiler, see if the leak is visible there, and then seeing what the rectangle UI code does and see if removing any of those things will make the leak go away

since this has been working fine all Unity versions prior, and doesn't seem to happen in all cases, this seems to be a Unity bug in a very specific configuration of platforms and/or project setups, so I don't know if there's much I can do about it

Avatar
Freya Holmér creator

okay - this is, more concerning than I thought. I *can* replicate it turns out, if I leave Unity running in the background, doing nothing for 5 minutes

have any of you been able to test this in the preview 2022.1 release, or later patch versions of 2021.2?

Avatar
devon merner
Quote from Freya Holmér

okay - this is, more concerning than I thought. I *can* replicate it turns out, if I leave Unity running in the background, doing nothing for 5 minutes

have any of you been able to test this in the preview 2022.1 release, or later patch versions of 2021.2?

Just tried 2021.2.12 (latest patch).  Same crash issue with IL2CPP and Incremental GC.

Avatar
kei
Quote from Freya Holmér

okay - this is, more concerning than I thought. I *can* replicate it turns out, if I leave Unity running in the background, doing nothing for 5 minutes

have any of you been able to test this in the preview 2022.1 release, or later patch versions of 2021.2?

K, just downloaded ( 2022.1.0.b8 - Windows) empty project imported in Shapes including your new patch from today and, yup it still getting hit with [ Fatal error in GC - Unexpected mark stack overflow ] after dragging around the inspector Offset variable on specifically the Disc Shapes component for a bit.

But strangely enough, for now... I cant get it to crash again after updating Shapes with your patch from today in my ( 2021.2.8.f1 - Windows) project ¯\_(ツ)_/¯

Just gonna make temporary full on meshes in Blender to use for now, but if there is any other data/ or set up you'd like tested just gimmie the params. 


Avatar
ross doran

For what it's worth, I was able to reproduce this pretty reliably on 2021.2.8f1 by creating dozens of Disc components and trying to change their color all at once. (Usually just a couple sets of 10 was enough to get the GC/Stack Overflow).

On 2023.2.18f1 this seems to be fixed.