Repository navigation
chore(deps): use SkiaSharp 3.119.2-preview.1 - #21643
Conversation
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21643/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21643/docs/index.html |
|
The build 179061 found UI Test snapshots differences: Details
|
|
Obvious question: what's changed between 3.119.0 and 3.119.2-preview.1? Answer: mono/SkiaSharp@release/3.119.0...release/3.119.2-preview.1 …which is an impressive 40 commits impacting 219 files (?!), many of which are |
Context: 41a5796 Context: #21477 (comment) Context: https://dev.azure.com/xamarin/public/_artifacts/feed/SkiaSharp/NuGet/_SymbolsPreview/overview/0.0.0-branch.release.3.119.2-preview.1.2266 After CoreCLR tests were merged (41a5796), we started seeing occasional flakiness on CI, in which `SamplesApp.Skia.netcoremobile` would *crash* within SkiaSharp: F DEBUG : Cause: null pointer dereference F DEBUG : rax 00000000000001a9 rbx 00007259ee698820 rcx 0000000000000000 rdx 0000000000000275 F DEBUG : r8 4d1f000000050005 r9 0000000000000000 r10 000072592e679b24 r11 0000000000000001 F DEBUG : r12 0000000000000330 r13 0000000000000033 r14 0000725a3e6f7670 r15 000072170df19fd8 F DEBUG : rdi 0000000000000330 rsi 000072170df19fd8 F DEBUG : rbp 0000000000000000 rsp 000072170df19f30 rip 00007217123b06b7 F DEBUG : 7 total frames F DEBUG : backtrace: F DEBUG : #00 pc 00000000003056b7 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #1 pc 00000000003052be /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #2 pc 00000000002e4b64 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #3 pc 0000000000274884 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #4 pc 000000000027469d /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #5 pc 000000000024f28f /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so (sk_canvas_draw_picture+95) F DEBUG : #6 pc 000000000010897e /memfd:doublemapper (deleted) (offset 0x3181000) @jonpryor suspects that this is because the GC is collecting *something*, which causes whatever SkiaSharp is attempting to use to be `null`. The question is, *what* is SkiaSharp attempting to use that triggers the SIGSEGV? Answering this requires debug symbols for SkiaSharp, which did not exist. Enter [SkiaSharp 3.119.2-preview.1][0], which *has* symbols, though it takes a bit of work to obtain them: 1. Go to <https://dev.azure.com/xamarin/public/_artifacts/feed/SkiaSharp/NuGet/_SymbolsPreview/overview/0.0.0-branch.release.3.119.2-preview.1.2266> 2. Click **↓ Download** 3. `unzip _SymbolsPreview.0.0.0-branch.release.3.119.2-preview.1.2266.nupkg` 4. `unzip -d _t tools/SkiaSharp.NativeAssets.Android.3.119.2-preview.1.symbols.nupkg` Then e.g. `_t/runtimes/android-x64/native/libSkiaSharp.so.dbg` contains debug symbols for `libSkiaSharp.so`. Update `.azure-devops-tests-android-coreclr-skia-build.yml` and `.azure-devops-tests-android-nativeaot-skia-build.yml` to override the `$(SkiaSharpVersion)` MSBuild property to 3.119.2-preview.1 so that the CoreCLR and NativeAOT builds of SamplesApp.Skia.netcoremobile are built using SkiaSharp 3.119.2-preview.1, so that when `SamplesApp.Skia.netcoremobile` crashes in the future, we can better investigate the native side of the crash. [0]: https://www.nuget.org/packages/SkiaSharp/3.119.2-preview.1
bf3b536 to
1b27c74
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21643/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21643/wasm-skia-net9/index.html |
|
The build 179181 found UI Test snapshots differences: Details
|
|
|
|
…and lucky me, the NativeAOT tests have a crash! Now that we have native debug symbols for % $HOME/android-toolchain/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-addr2line -paCif -e libSkiaSharp.so 00000000003057c7
0x3057c7: SkRecord::Record::type() const at C:/a/_work/1/s/externals/skia/out/android/x86_64/../../../src/core/SkRecord.h:147
(inlined by) decltype(fp((SkRecords::NoOp)())) SkRecord::Record::visit<SkRecords::Draw&>(SkRecords::Draw&) const at C:/a/_work/1/s/externals/skia/out/android/x86_64/../../../src/core/SkRecord.h:154which gives a native stack trace of: Or, in GitHub link form:
|
Context: 41a5796 Context: 92676ea Context: #21656 (comment) Context: #21643 Context: https://learn.microsoft.com/en-us/archive/blogs/cbrumme/lifetime-gc-keepalive-handle-recycling Ever since the integration of running `SamplesApp.Skia.netcoremobile` on CoreCLR (41a5796) and NativeAOT (92676ea), we've seen "flakiness" in unit test execution, with the test harness occasionally crashing: F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000610 F DEBUG : Cause: null pointer dereference F DEBUG : rax 0000000000000108 rbx 000073a6f12f0210 rcx 0000000000000000 rdx 000000000000007a F DEBUG : r8 d92d00000010200b r9 00007364a8b8ea00 r10 0000000000000000 r11 0000000000000000 F DEBUG : r12 0000000000000610 r13 0000000000000061 r14 000073a6612f43f0 r15 00007364a76012d8 F DEBUG : rdi 0000000000000610 rsi 00007364a76012d8 F DEBUG : rbp 0000000000000000 rsp 00007364a7601230 rip 00007364a8db47c7 F DEBUG : 25 total frames F DEBUG : backtrace: F DEBUG : #00 pc 00000000003057c7 /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSkiaSharp.so F DEBUG : #1 pc 00000000003053ce /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSkiaSharp.so F DEBUG : #2 pc 00000000002e4c74 /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSkiaSharp.so F DEBUG : #3 pc 00000000002749a4 /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSkiaSharp.so F DEBUG : #4 pc 00000000002747bd /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSkiaSharp.so F DEBUG : #5 pc 000000000024f36f /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSkiaSharp.so (sk_canvas_draw_picture+95) F DEBUG : #6 pc 0000000009acb685 /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSamplesApp.so (SkiaSharp_SkiaSharp_SkiaApi__sk_canvas_draw_picture+101) (BuildId: 5f9d8dc654dfed4438273840dd8a19b67d66bc03) F DEBUG : #7 pc 000000000aa5a09d /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSamplesApp.so (Uno_UI_Uno_UI_Helpers_SkiaRenderHelper__RenderPicture+141) (BuildId: 5f9d8dc654dfed4438273840dd8a19b67d66bc03) F DEBUG : #8 pc 000000000a2d49a9 /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSamplesApp.so (Uno_UI_Microsoft_UI_Xaml_Media_CompositionTarget__Draw+777) (BuildId: 5f9d8dc654dfed4438273840dd8a19b67d66bc03) F DEBUG : #9 pc 000000000a2d5c09 /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSamplesApp.so (Uno_UI_Microsoft_UI_Xaml_Media_CompositionTarget__OnNativePlatformFrameRequested+553) (BuildId: 5f9d8dc654dfed4438273840dd8a19b67d66bc03) F DEBUG : #10 pc 000000000b05777e /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSamplesApp.so (Uno_UI_Runtime_Skia_Android_Uno_UI_Runtime_Skia_Android_UnoSKCanvasView_InternalRenderer__Android_Opengl_GLSurfaceView_IRenderer_OnDrawFrame+270) (BuildId: 5f9d8dc654dfed4438273840dd8a19b67d66bc03) F DEBUG : #11 pc 00000000086a4401 /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSamplesApp.so (Mono_Android_Android_Opengl_GLSurfaceView_IRendererInvoker__n_OnDrawFrame_Ljavax_microedition_khronos_opengles_GL10_+193) (BuildId: 5f9d8dc654dfed4438273840dd8a19b67d66bc03) F DEBUG : #12 pc 000000000ca286ba /data/app/~~ZYVR5YT-bvI6JuPKmxmqTg==/uno.platform.samplesapp.skia.nativeaot-xixpSuclgZh9X9KMhU1l5A==/lib/x86_64/libSamplesApp.so (Internal_CompilerGenerated__Module___<ReverseOpenStaticDelegateStub>Mono_Android__JniMarshal_PPL_V+90) (BuildId: 5f9d8dc654dfed4438273840dd8a19b67d66bc03) F DEBUG : #13 pc 0000000000391a4b /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+219) (BuildId: b6dc79e02101ea00827a35a55ab6597a) With #21643, we're now able to symbolicate the native side of the crash and gain a better understanding of what's happening. What *appears* to be happening is that the CoreCLR & NativeAOT GC is collecting a managed instance while it's "native side" is still being used by native code: 1. Main thread: calls `CompositionHelper.Render()`, which sets `CompositionHelper._lastRenderedFrame`. 2. Render thread: reads `CompositionHelper._lastRenderedFrame` into `lastRenderedFrame`, eventually calls `canvas.DrawPicture(lastRenderedFrame.frame)`; 3. Render thread is suspended within native code, "within" `canvas.DrawPicture(lastRenderedFrame.frame)`. 4. GC thread comes along, sees that (`picture` parameter in `SkiaRenderHelper.RenderPicture()` / `lastRenderedFrame.frame` value within `CompositionTarget.Draw()`) is no longer referenced from managed code. 5. GC thread invokes `lastRenderedFrame.frame.Finalize()` 6. `SKPicture` (SkiaSharp) / `SkBigPicture` (Skia) is finalized. 7. Render thread resumes within native code, accesses the `SkBigPicture` *destroyed* in (6). 8. SIGSEGV A plausible solution to the above scenario is to extend the lifetime of `lastRenderedFrame.frame` until *after* `canvas.DrawPicture()` completes. This can be done via `GC.KeepAlive()`.
Context: 41a5796
Context: #21477 (comment)
Context: https://dev.azure.com/xamarin/public/_artifacts/feed/SkiaSharp/NuGet/_SymbolsPreview/overview/0.0.0-branch.release.3.119.2-preview.1.2266
After CoreCLR tests were merged (41a5796), we started seeing occasional flakiness on CI, in which
SamplesApp.Skia.netcoremobilewould crash within SkiaSharp:@jonpryor suspects that this is because the GC is collecting something, which causes whatever SkiaSharp is attempting to use to be
null. The question is, what is SkiaSharp attempting to use that triggers the SIGSEGV?Answering this requires debug symbols for SkiaSharp, which did not exist.
Enter SkiaSharp 3.119.2-preview.1, which has symbols, though it takes a bit of work to obtain them:
unzip _SymbolsPreview.0.0.0-branch.release.3.119.2-preview.1.2266.nupkgunzip -d _t tools/SkiaSharp.NativeAssets.Android.3.119.2-preview.1.symbols.nupkgThen e.g.
_t/runtimes/android-x64/native/libSkiaSharp.so.dbgcontains debug symbols forlibSkiaSharp.so.Bump
$(SkiaSharpVersion)to 3.119.2-preview.1, so that whenSamplesApp.Skia.netcoremobilecrashes in the future, we can better investigate the native side of the crash.GitHub Issue: closes #
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️