Crash in TMP

I’ve recently got a few crash reports, and finally I got a stack trace for one of them:

========== OUTPUTTING STACK TRACE ==================

0x00007FFC7C1A07D3 (ntdll) RtlGetCurrentServiceSessionId
0x00007FFC7C19FB91 (ntdll) RtlFreeHeap
0x00007FFC16365D68 (UnityPlayer) UnityMain
0x00007FFC15DB7101 (UnityPlayer) UnityMain
0x00007FFC15BE6890 (UnityPlayer) UnityMain
0x00007FFC15BE5F80 (UnityPlayer) UnityMain
0x00007FFC15BEAC1D (UnityPlayer) UnityMain
0x0000016196A4272C (Mono JIT Code) (wrapper managed-to-native) UnityEngine.TextCore.LowLevel.FontEngine:TryAddGlyphToTexture_Internal (uint,int,UnityEngine.TextCore.LowLevel.GlyphPackingMode,UnityEngine.TextCore.GlyphRect[],int&,UnityEngine.TextCore.GlyphRect[],int&,UnityEngine.TextCore.LowLevel.GlyphRenderMode,UnityEngine.Texture2D,UnityEngine.TextCore.LowLevel.GlyphMarshallingStruct&)
0x0000016186E7C393 (Mono JIT Code) TMPro.TMP_Text:GetTextElement (uint,TMPro.TMP_FontAsset,TMPro.FontStyles,TMPro.FontWeight,bool&)
0x0000016122EC7BC3 (Mono JIT Code) TMPro.TextMeshProUGUI:SetArraySizes (TMPro.TMP_Text/UnicodeChar[])
0x0000016122EC5D3C (Mono JIT Code) TMPro.TMP_Text:ParseInputText ()
0x0000016122EC5ABB (Mono JIT Code) TMPro.TextMeshProUGUI:OnPreRenderCanvas ()
0x0000016122EC58CB (Mono JIT Code) TMPro.TextMeshProUGUI:Rebuild (UnityEngine.UI.CanvasUpdate)
0x0000016122EC49BC (Mono JIT Code) UnityEngine.UI.CanvasUpdateRegistry:PerformUpdate ()
0x0000016122EC4562 (Mono JIT Code) (wrapper delegate-invoke) <Module>:invoke_void ()
0x0000016122EC4391 (Mono JIT Code) UnityEngine.Canvas:SendWillRenderCanvases ()
0x0000016122EC442D (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
0x00007FFC1867B7A0 (mono-2.0-bdwgc) mono_get_runtime_build_info
0x00007FFC18601882 (mono-2.0-bdwgc) mono_perfcounters_init
0x00007FFC1860A87F (mono-2.0-bdwgc) mono_runtime_invoke
0x00007FFC15A936F4 (UnityPlayer) UnityMain
0x00007FFC15A90F20 (UnityPlayer) UnityMain
  ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC154310BF)
0x00007FFC154310BF (UnityPlayer) (function-name not available)
0x00007FFC1599A347 (UnityPlayer) UnityMain
0x00007FFC1599A3E9 (UnityPlayer) UnityMain
0x00007FFC1599C39F (UnityPlayer) UnityMain
  ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC15774965)
0x00007FFC15774965 (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC15772F9A)
0x00007FFC15772F9A (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC15777820)
0x00007FFC15777820 (UnityPlayer) (function-name not available)
0x00007FFC1577BA7B (UnityPlayer) UnityMain
  ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FF61F3111FA)
0x00007FF61F3111FA (Mesmer) (function-name not available)
0x00007FFC7B3C7BD4 (KERNEL32) BaseThreadInitThunk
0x00007FFC7C1CCE51 (ntdll) RtlUserThreadStart

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

This is on Unity 2018.4.24f1, and TMP 1.5.1.

One thing to note is that we somewhat recently went from packing our fonts statically to packing them dynamically, in order to be able to support translating to new languages without having to remember to rebake all the fonts.

I’m not sure if it’s related, but it does sound very fishy, especially since it’s crashing on thrying to resolve glyphs.

Any ideas? We’re supposed to ship very soon, so I might just have to go back to static fonts and hope really hard that that fixes the issue, but I’d love to get some better info on this.

Are you creating those font assets at runtime or just using dynamic font assets which are shipped with the project?

Are you able to reliably reproduce this behavior? Any chance you can submit a bug report for me to look at?

Dynamic font assets which are shipped with the project.

And I haven't found a repro case yet, it seems to be something along the lines of "when an arbitrary dialogue starts after playing the game for an hour or so".

Those are always fun to isolate :wink:

Do you have Multi Atlas Texture enabled on that font asset? Perhaps the atlas texture is full… that should not crash but that might give us a clue.

So see if enabling Multi Atlas Texture changes the behavior or using a larger atlas texture.

Make sure you also Reset the font asset before creating the build so that it is empty to begin with.

1 Like

We have Multi Atlas Texture enabled. We do not reset the font asset before creating the build, that might be the issue. I'll add that to our build scripts.

It's a bit annoying that the texture is saved to file whenever it auto-expands, as that causes a bunch of version control noise. Any chance that those textures could be made to not save in some fashion?

In the next release, an option to automatically “Clear Dynamic Data on Build” has been added per font asset.

With regards to Dynamic Font Asset changes, they are persistent in the Editor but not in builds. Changing this behavior is problematic given many users run full dynamic through most of the development cycle to populate these font assets, allowing them to get a better sense of glyph coverage and overall settings before switching some of these font asset to static before shipping.

Additional feedback on how to handle these different use cases will be needed.

How do I reset the font assets from editor code? Can’t find a method that seems to do it as I was trying to add it to our build pipeline. For now I’m just manually reseting them, but I’m not going to remember that.

The point about figuring out glyph coverage is interesting. I can’t see a situation where we need to figure out glyph coverage without just iterating all the text in our project, but if text is getting pulled from sources where that’s not easy, maybe it’s an issue?

For us, assets other than the one we intended to change changing causes a lot of problems - people get (more) confused about version control, and we get conflicts on things that nobody intended to do any work on. Being able to have the dynamic font assets not be persistent in the editor would be an improvement for us, but I know that Unity in general is very, very afraid of toggles.

Hi @Stephan_B I would like to report the same issue, but on version 2.1.4, which is newer than the last post to this thread. I’ve attached logs here. I’m going to try to update to 2.1.6, but I have no idea how to reproduce the issue at this stage so I won’t be able to confirm the fix any time soon.

The only change I can think of is that I recently regenerated all the font atlases using the “ASCII” preset. However they are still on dynamic (as they have been for a year). I was actually in the process of moving to static generation to prevent the version control thrashing issue that Baste reported above. From my understanding there is some fundamental problem where font data is stored in Assets/ instead of Library/ as is standard for importer generated content?

Anyway, I’ve written a script that captures all the characters used in our entire game and turns them into a hex range string as accepted by the font builder, but am hitting this same problem that @Baste is hitting above. I have no idea how to automate the font atlas generation as part of our build process. Did you ever find out how to do this procedurally @Baste ?

7266664–877057–TMP crash (22.3 KB)

Ah, could this be the issue fixed in 2.1.5?

See if you still get the issue using 2.1.6 which is the latest release for 2019.4.

It was intermittent and we haven’t seen it since upgrading to latest.