SkiaSharp: [BUG] macOS native crashes in gr_backendrendertarget_get_gl_framebufferinfo
Description
i using SkiaSharp in a Xamarin.Forms app on macOS, after following the discussion in #1144 i have updated to the latest preview .45 which unfortunately doesn’t solve the issue with native crashes for me (gr_backendrendertarget_get_gl_framebufferinfo
). I have a different issue open which is related to SKImage
#1164 but i’m not sure if this is the same - so here is a new open issue 🤓
I’m using an SKGLView
to draw several shapes and images which lead to a freeze and the following native crash.
Code
in my case it might be related with GRContext.GetResourceCacheUsage
🤷♂️
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Native stacktrace:
=================================================================
0x107350d28 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_dump_native_crash_info
0x1073446e5 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_handle_native_crash
0x107661303 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : altstack_handle_and_restore.cold.1
0x1072c1dac - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : altstack_handle_and_restore
0x107d34465 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x142ab5e43 - Unknown
0x142ab5c3b - Unknown
0x142ab4803 - Unknown
0x14294fec3 - Unknown
0x142949c63 - Unknown
0x142946c14 - Unknown
0x142946ae8 - Unknown
0x142944bed - Unknown
0x142943d6b - Unknown
0x142943f7e - Unknown
0x10735b1ee - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_jit_runtime_invoke
0x10748d318 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_runtime_invoke_checked
0x107491c9e - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_runtime_invoke
0x1072133d2 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : xamarin_invoke_trampoline
0x10721499b - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : xamarin_arch_trampoline
0x107215bc6 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : xamarin_x86_64_common_trampoline
0x7fff33acfe29 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSWindow(NSGestureRecognizer_Routing) _sendEventToGestureRecognizers:requireAcceptsFirstMouse:]
0x7fff33ad7ac2 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:]
0x7fff33a41c5c - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]
0x7fff33a41005 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSWindow(NSEventRouting) sendEvent:]
0x7fff33a3f37c - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication(NSEvent) sendEvent:]
0x7fff3388b0cf - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication run]
0x7fff3385d465 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : NSApplicationMain
0x1113e8aec - Unknown
0x1112bc2a3 - Unknown
0x10879d8fb - Unknown
0x10879da91 - Unknown
0x10735b1ee - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_jit_runtime_invoke
0x10748d318 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_runtime_invoke_checked
0x1074947c5 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_runtime_exec_main_checked
0x1072b7e9c - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_jit_exec
0x1072bafd4 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : mono_main
0x107216578 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : xamarin_main
0x1072173e4 - /Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MacOS/Project : main
0x7fff6dd7a7fd - /usr/lib/system/libdyld.dylib : start
=================================================================
Telemetry Dumper:
=================================================================
Pkilling 0x70000a25d000 from 0x108a2edc0
Pkilling 0x70000e14f000 from 0x108a2edc0
Pkilling 0x70000a866000 from 0x108a2edc0
Pkilling 0x70000b587000 from 0x108a2edc0
Pkilling 0x70000e758000 from 0x108a2edc0
Pkilling 0x70000ae6f000 from 0x108a2edc0
Pkilling 0x70000bb90000 from 0x108a2edc0
Pkilling 0x70000ed61000 from 0x108a2edc0
Pkilling 0x70000c199000 from 0x108a2edc0
Pkilling 0x70000c7a2000 from 0x108a2edc0
Pkilling 0x70000d740000 from 0x108a2edc0
Pkilling 0x70000e352000 from 0x108a2edc0
Pkilling 0x70000aa69000 from 0x108a2edc0
Pkilling 0x70000b78a000 from 0x108a2edc0
Pkilling 0x70000e95b000 from 0x108a2edc0
Pkilling 0x70000b072000 from 0x108a2edc0
Pkilling 0x70000bd93000 from 0x108a2edc0
Pkilling 0x70000c39c000 from 0x108a2edc0
Pkilling 0x700009d51000 from 0x108a2edc0
Pkilling 0x70000c9a5000 from 0x108a2edc0
Pkilling 0x70000d943000 from 0x108a2edc0
Pkilling 0x70000df4c000 from 0x108a2edc0
Pkilling 0x70000a663000 from 0x108a2edc0
Pkilling 0x70000e555000 from 0x108a2edc0
Pkilling 0x70000ac6c000 from 0x108a2edc0
Pkilling 0x70000b98d000 from 0x108a2edc0
Pkilling 0x70000eb5e000 from 0x108a2edc0
Pkilling 0x70000b275000 from 0x108a2edc0
Pkilling 0x70000bf96000 from 0x108a2edc0
Pkilling 0x700009f54000 from 0x108a2edc0
Pkilling 0x70000cba8000 from 0x108a2edc0
Pkilling 0x70000d1b1000 from 0x108a2edc0
Could not exec mono-hang-watchdog, expected on path '/Users/Documents/Dev/Project/Project.MyProject.MacOS/bin/Debug/Project.app/Contents/MonoBundle/../bin/mono-hang-watchdog' (errno 2)
Entering thread summarizer pause from 0x108a2edc0
Finished thread summarizer pause from 0x108a2edc0.
Waiting for dumping threads to resume
=================================================================
External Debugger Dump:
=================================================================
socket_transport_send Cannot transition thread 0x108a2edc0 from STATE_BLOCKING with DO_BLOCKING
Expected Behavior
SKGLView should render without any problems+
Actual Behavior
random freezes and stuck app - only force close or killall lldb
helps in my case
Basic Information
-
Version with issue: 1.68.2-preview.45
-
IDE: Visual Studio for Mac 8.5 (build 3183)
-
Platform Target Frameworks:
- macOS: 10.15.3 (19D76)
-
Target Devices:
- MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports) | 16 GB 2133 MHz LPDDR3 | 2,3 GHz Quad-Core Intel Core i5 | Intel Iris Plus Graphics 655 1536 MB
Reproduction Link
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (8 by maintainers)
seems to be fixed by #1224. after a lot of testing i don’t get any crashes so i’m closing this now, hopefully for good
@nor0x I have pushed what I think is now a good version to the preview feed: https://aka.ms/skiasharp-eap/index.json Check out the PR version: 1.68.2-pr.1200.20
Let me know how it goes.
I think I found the cause and fix of the issue. It was due to concurrency with the construction and destruction of objects with the same native handle. As soon as PR #1200 is complete, then I’ll push to the preview feed for testing.
Awesome, thanks. Let me see what I can do with what I have right now and then if that doesn’t work we can talk about your code.