Segfault on Linux build
jamezrin opened this issue · 4 comments
I just started the binary and after some time it just SEGFAULTs, the last time I tried it I did it with gdb attached and this is the log and backtrace:
~/Desktop/quest-discord-presence 8s ⎈ minikube
❯ gdb ./Quest-Discord-Presence-Client
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./Quest-Discord-Presence-Client...
(No debugging symbols found in ./Quest-Discord-Presence-Client)
(gdb) run
Starting program: /home/jamezrin/Desktop/quest-discord-presence/Quest-Discord-Presence-Client
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff6de5640 (LWP 32489)]
[New Thread 0x7ffff65c4640 (LWP 32490)]
[New Thread 0x7ffff5dc3640 (LWP 32491)]
[New Thread 0x7ffff5123640 (LWP 32492)]
[New Thread 0x7ffff4912640 (LWP 32493)]
[New Thread 0x7ffff4111640 (LWP 32494)]
Loading config
[New Thread 0x7ffff193f640 (LWP 32495)]
[New Thread 0x7ffff113e640 (LWP 32496)]
[New Thread 0x7ffff1059640 (LWP 32497)]
[New Thread 0x7ffff0858640 (LWP 32498)]
Querying Quest for presence . . .
Hello from UI thread
[New Thread 0x7fffefda2640 (LWP 32499)]
Successfully fetched presence
[New Thread 0x7fff7cb26640 (LWP 32500)]
[New Thread 0x7fff564fa640 (LWP 32501)]
[New Thread 0x7fff55cf9640 (LWP 32502)]
[New Thread 0x7fff554f8640 (LWP 32503)]
[New Thread 0x7fff54cf7640 (LWP 32504)]
[New Thread 0x7fff29d54640 (LWP 32505)]
[New Thread 0x7fff29553640 (LWP 32506)]
[New Thread 0x7fff28d52640 (LWP 32508)]
[New Thread 0x7fff0bfff640 (LWP 32509)]
[New Thread 0x7fff0b7fe640 (LWP 32510)]
[New Thread 0x7fff0a38e640 (LWP 32514)]
Started counting elapsed time
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
[Thread 0x7fff28d52640 (LWP 32508) exited]
Successfully fetched presence
[New Thread 0x7fff28d52640 (LWP 32536)]
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Stopped counting elapsed time
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
[Thread 0x7fff28d52640 (LWP 32536) exited]
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
[New Thread 0x7fff28d52640 (LWP 32576)]
Started counting elapsed time
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Successfully fetched presence
Thread 11 "Quest-Discord-P" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff0858640 (LWP 32498)]
0x00007ffff7ac0275 in _int_malloc () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff7ac0275 in _int_malloc () from /usr/lib/libc.so.6
#1 0x00007ffff7ac14e1 in malloc () from /usr/lib/libc.so.6
#2 0x00007ffff7ac534f in strdup () from /usr/lib/libc.so.6
#3 0x00007fff7c11fd54 in ?? () from /usr/lib/libfontconfig.so.1
#4 0x00007fff7c124d66 in ?? () from /usr/lib/libfontconfig.so.1
#5 0x00007fff7c13e5a4 in FcFontRenderPrepare () from /usr/lib/libfontconfig.so.1
#6 0x00007fff7c13eb9e in FcFontMatch () from /usr/lib/libfontconfig.so.1
#7 0x00007fff0aa88d24 in ?? () from /home/jamezrin/Desktop/quest-discord-presence/libSkiaSharp.so
#8 0x00007fff0aa86e75 in ?? () from /home/jamezrin/Desktop/quest-discord-presence/libSkiaSharp.so
#9 0x00007fff0a56841f in ?? () from /home/jamezrin/Desktop/quest-discord-presence/libSkiaSharp.so
#10 0x00007fff0a607c62 in ?? () from /home/jamezrin/Desktop/quest-discord-presence/libSkiaSharp.so
#11 0x00007fff0a52e4a6 in sk_typeface_create_from_name_with_font_style ()
from /home/jamezrin/Desktop/quest-discord-presence/libSkiaSharp.so
#12 0x00007fff80a9bb18 in ?? ()
#13 0x00007ffff0050000 in ?? ()
#14 0x00007fff80a9ba51 in ?? ()
#15 0x00007ffff0059890 in ?? ()
#16 0x00007fff58e42850 in ?? ()
#17 0x0000000000e85d2c in ?? ()
#18 0x00007ffff7513718 in vtable for InlinedCallFrame ()
from /home/jamezrin/Desktop/quest-discord-presence/libcoreclr.so
#19 0x00007ffff0857bc0 in ?? ()
#20 0x00007fff8076dfd0 in ?? ()
#21 0x00007fff8076dfd0 in ?? ()
#22 0x00007ffff0059890 in ?? ()
#23 0x00007fff80a9bb18 in ?? ()
#24 0x00007ffff0059940 in ?? ()
#25 0x00007ffff0059910 in ?? ()
#26 0x00007fff8076dfd0 in ?? ()
#27 0x0000000000e85d2c in ?? ()
#28 0x0000000180a9c0a3 in ?? ()
#29 0x00007ffff0059880 in ?? ()
#30 0x00007ffff0059880 in ?? ()
#31 0x00000001f0059940 in ?? ()
#32 0x00007fff57fff360 in ?? ()
#33 0x0000000000000000 in ?? ()
I built the app with the debug build config but I couldn't get the app to pick up my config.json, otherwise I would have provided you with the trace with symbols
It's because of this issue AvaloniaUI/Avalonia#4427. Avalonia is not handling fonts correctly on Linux, specially if your main locale includes non-latin characters.
Ah impressive find. Hopefully that gets patched and I can bump the version of this client.
In the latest version of Avalonia, it also throws this exception:
Unhandled exception. System.InvalidOperationException: Default font family name can't be null or empty.
at Avalonia.Media.FontManager..ctor(IFontManagerImpl platformImpl) in /_/src/Avalonia.Visuals/Media/FontManager.cs:line 31
at Avalonia.Media.FontManager.get_Current() in /_/src/Avalonia.Visuals/Media/FontManager.cs:line 50
at Avalonia.Media.TextFormatting.TextCharacters.TryGetRunProperties(ReadOnlySlice`1 text, Typeface typeface, Typeface defaultTypeface, Int32& count) in /_/src/Avalonia.Visuals/Media/TextFormatting/TextCharacters.cs:line 129
at Avalonia.Media.TextFormatting.TextCharacters.CreateShapeableRun(ReadOnlySlice`1 text, TextRunProperties defaultProperties) in /_/src/Avalonia.Visuals/Media/TextFormatting/TextCharacters.cs:line 62
at Avalonia.Media.TextFormatting.TextCharacters.GetShapeableCharacters() in /_/src/Avalonia.Visuals/Media/TextFormatting/TextCharacters.cs:line 40
at Avalonia.Media.TextFormatting.TextFormatterImpl.FetchTextRuns(ITextSource textSource, Int32 firstTextSourceIndex, TextLineBreak previousLineBreak, TextLineBreak& nextLineBreak) in /_/src/Avalonia.Visuals/Media/TextFormatting/TextFormatterImpl.cs:line 280
at Avalonia.Media.TextFormatting.TextFormatterImpl.FormatLine(ITextSource textSource, Int32 firstTextSourceIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak) in /_/src/Avalonia.Visuals/Media/TextFormatting/TextFormatterImpl.cs:line 15
at Avalonia.Media.TextFormatting.TextLayout.UpdateLayout() in /_/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs:line 228
at Avalonia.Media.TextFormatting.TextLayout..ctor(String text, Typeface typeface, Double fontSize, IBrush foreground, TextAlignment textAlignment, TextWrapping textWrapping, TextTrimming textTrimming, TextDecorationCollection textDecorations, Double maxWidth, Double maxHeight, Double lineHeight, Int32 maxLines, IReadOnlyList`1 textStyleOverrides) in /_/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs:line 72
at Avalonia.Controls.TextBlock.CreateTextLayout(Size constraint, String text) in /_/src/Avalonia.Controls/TextBlock.cs:line 475
at Avalonia.Controls.TextBlock.get_TextLayout() in /_/src/Avalonia.Controls/TextBlock.cs:line 166
at Avalonia.Controls.TextBlock.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/TextBlock.cs:line 521
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 559
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Controls.StackPanel.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/StackPanel.cs:line 208
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 559
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding) in /_/src/Avalonia.Layout/LayoutHelper.cs:line 47
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding, Thickness borderThickness) in /_/src/Avalonia.Layout/LayoutHelper.cs:line 39
at Avalonia.Controls.Border.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/Border.cs:line 121
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 559
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Controls.StackPanel.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/StackPanel.cs:line 208
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 559
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding) in /_/src/Avalonia.Layout/LayoutHelper.cs:line 47
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding, Thickness borderThickness) in /_/src/Avalonia.Layout/LayoutHelper.cs:line 39
at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/Presenters/ContentPresenter.cs:line 362
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 559
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding) in /_/src/Avalonia.Layout/LayoutHelper.cs:line 47
at Avalonia.Controls.Primitives.VisualLayerManager.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/Primitives/VisualLayerManager.cs:line 133
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 559
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 626
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 559
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 626
at Avalonia.Controls.Window.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/Window.cs:line 888
at Avalonia.Controls.WindowBase.MeasureCore(Size availableSize) in /_/src/Avalonia.Controls/WindowBase.cs:line 237
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Layout/Layoutable.cs:line 364
at Avalonia.Layout.LayoutManager.Measure(ILayoutable control) in /_/src/Avalonia.Layout/LayoutManager.cs:line 294
at Avalonia.Layout.LayoutManager.ExecuteInitialLayoutPass() in /_/src/Avalonia.Layout/LayoutManager.cs:line 175
at Avalonia.Controls.Window.ShowCore(Window parent) in /_/src/Avalonia.Controls/Window.cs:line 690
at Avalonia.Controls.Window.Show() in /_/src/Avalonia.Controls/Window.cs:line 627
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 126
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 175
at Quest_Discord_Presence_Client.Client.<>c__DisplayClass17_0.<InitializeUI>b__0() in /home/jamezrin/dev/contrib/Quest-Discord-Presence-Client/src/Client.cs:line 51
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
To make the app not crash constantly, I just added a try catch wrapping the code in the UI thread, something like this:
jamezrin@98a6794
Good to know, I can merge that little change if you PR.