react-native-skia icon indicating copy to clipboard operation
react-native-skia copied to clipboard

[Android/Graphite] Adreno 830 crashes in vkCreateFramebuffer; disabling MSAARenderToSingleSampled avoids the crash

Open ryuhzk opened this issue 1 month ago • 2 comments

[Android/Graphite] SIGSEGV in Adreno vkCreateFramebuffer; omitting MSAARenderToSingleSampled avoids the crash

Description

Opening a single animated flowchart causes a native SIGSEGV on a physical Samsung device with an Adreno 830 GPU. The crash occurs in the vendor Vulkan driver's vkCreateFramebuffer, called by Dawn's RecordBeginRenderPass, during Skia Graphite presentation.

We reproduced it both in our application and in our independent diagram example app. The example does not require a server, account, conversation history, or a list containing many diagrams. Selecting one Flowchart from its gallery was sufficient to reproduce the same native stack.

In an A/B experiment, we rebuilt the same example after removing only wgpu::FeatureName::MSAARenderToSingleSampled from the primary device's requested features in cpp/rnskia/RNDawnUtils.h. The device owner reports that this build no longer crashes. Ordinary MSAA remains available; we did not disable diagram animations or anti-aliasing.

This points to the render-to-single-sampled path, but does not establish whether the defect is in the driver, Dawn, or a render-pass configuration generated by Graphite.

Environment

  • Physical device model: Samsung SM-S9370
  • Android: 16
  • ABI: arm64-v8a
  • GPU selected by Dawn: Adreno (TM) 830
  • Backend: Vulkan / Skia Graphite
  • Vulkan driver version: 0800.64.7
  • Reproduction example: react-native-skia 3.0.3, React Native 0.86.3, React 19.3.0, Expo 57.0.26, Reanimated 4.7.1, Worklets 0.13.0
  • New Architecture: enabled; Android release build
  • The device owner also reports the application still crashed after upgrading to Skia 3.0.5. The directly captured example A/B experiment above was on 3.0.3.
  • The same failure was not reproduced on our Android x86_64 emulators. Those results do not establish physical-device compatibility.

Reproduction

Pinned source: https://github.com/osuki-dev/skia-diagrams/tree/7f634cebe6a128d538a3e8d94004e731eb90a9be/example

This is a reproducible example, not yet a minimal Skia-only reproduction. It includes our diagram parser, layout, and animation layer. It uses Skia directly, without a WebView.

With Bun 1.4.2, Java, and the Android SDK installed:

git clone https://github.com/osuki-dev/skia-diagrams.git
cd skia-diagrams
git checkout 7f634cebe6a128d538a3e8d94004e731eb90a9be
bun install --frozen-lockfile
bun run build
bun link
cd example
bun install --frozen-lockfile
bunx expo prebuild --platform android --no-install
./android/gradlew -p android :app:assembleRelease -PreactNativeArchitectures=arm64-v8a

Install example/android/app/build/outputs/apk/release/app-release.apk on the affected physical device. Open Skia Diagrams Gallery, then select Flowchart. We observed the application terminate on entering the diagram, without needing to open its fullscreen viewer or scroll through many diagrams.

Expected: the diagram appears and its entrance animation completes. Actual: process terminates with SIGSEGV at address 0x8.

Native stack (relevant frames)

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
Cause: null pointer dereference

#00 vulkan.adreno.so [vendor driver]
#01 vulkan.adreno.so [vendor driver]
#02 vulkan.adreno.so qglinternal::vkCreateFramebuffer(...)+320
#03 libwebgpu_dawn.so dawn::native::vulkan::RecordBeginRenderPass(...)+2120
#04 libwebgpu_dawn.so dawn::native::vulkan::CommandBuffer::RecordRenderPass(...)
#05 libwebgpu_dawn.so dawn::native::vulkan::CommandBuffer::RecordCommands(...)
#06 libwebgpu_dawn.so dawn::native::vulkan::Queue::SubmitImpl(...)
#07 libwebgpu_dawn.so dawn::native::QueueBase::SubmitInternal(...)
#08 libwebgpu_dawn.so dawn::native::QueueBase::APISubmit(...)
#09 libwebgpu_dawn.so dawn::native::NativeQueueSubmit(...)
...
RNSkia::DawnContext::insertRecordings(...)
RNSkia::DawnWindowContext::presentRecordings(...)
RNSkia::RNSkView::present(...)
RNSkia::RNSkView::presentFrame()

Android's process exit record classifies this as APP CRASH(NATIVE), status 11, rather than a low-memory termination.

Workaround / comparison

In example/node_modules/react-native-skia/cpp/rnskia/RNDawnUtils.h, remove this requested feature from createDawnBackendContext and rebuild the native APK:

 std::vector<wgpu::FeatureName> features = {
-    wgpu::FeatureName::MSAARenderToSingleSampled,
     wgpu::FeatureName::TransientAttachments,

Everything else in the example was unchanged for this experiment. Baseline crashed with the stack above; the device owner reports the modified build does not crash. This is a workaround result, not a claim of exhaustive stress testing or a proven driver root cause.

Our diagram library's 0.1.1 release also changed opacity compositing layers to clip-based visibility and removed an outer layer. The device owner reports that single-diagram entry was less problematic on 0.1.0, although repeated open/close and many diagrams could still crash. These changes may expose the failing graphics path; we have not isolated which draw operation is essential, so we are including this potentially relevant context.

Would it be appropriate to gate MSAARenderToSingleSampled for this adapter/driver, or should we reduce this further for a Dawn bug report? We can provide the relevant native crash excerpt and the baseline/workaround APKs if useful.

ryuhzk avatar Oct 07 '26 03:10 ryuhzk

Additional diagnostic evidence: below is the complete 42-frame backtrace from a pre-workaround application crash on the affected device. The independent example reproduced the same top-level vkCreateFramebuffer failure; this particular full trace is from the application, not the example.

Privacy edits: logcat timestamps/process identifiers and app-specific installation paths are omitted or replaced with <app>. Device serial, build fingerprint, account/network information, conversation data, and unrelated logcat messages are not included. Relative program counters, symbol offsets, and library BuildIds are retained for symbolication. This is a filtered crash excerpt, not the full device log.

Android classified this exit as APP CRASH(NATIVE), status 11.

Sanitized native crash backtrace (42 frames)
ABI: 'arm64'
Process uptime: 128s
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000008 (read)
Cause: null pointer dereference
42 total frames
backtrace:
#00 pc 00000000001d058c  /vendor/lib64/hw/vulkan.adreno.so (!!!0000!db133968c896ab4da80ab74ca293d0!f61dec9117!+1116) (BuildId: 1267f8e0425e6782225076cf3e39aa61)
#01 pc 00000000001bb580  /vendor/lib64/hw/vulkan.adreno.so (!!!0000!f29c702e83e1ff0960bb4066d06322!f61dec9117!+768) (BuildId: 1267f8e0425e6782225076cf3e39aa61)
#02 pc 0000000000187e50  /vendor/lib64/hw/vulkan.adreno.so (qglinternal::vkCreateFramebuffer(VkDevice_T*, VkFramebufferCreateInfo const*, VkAllocationCallbacks const*, VkFramebuffer_T**)+320) (BuildId: 1267f8e0425e6782225076cf3e39aa61)
#03 pc 000000000089b194  <app>/lib/arm64/libwebgpu_dawn.so (dawn::native::vulkan::RecordBeginRenderPass(dawn::native::vulkan::CommandRecordingContext*, dawn::native::vulkan::Device*, dawn::native::BeginRenderPassCmd*)+2120) (BuildId: 0fc9db919b3e4f74e7394d5817f46e8d1bb139eb)
#04 pc 000000000089d350  <app>/lib/arm64/libwebgpu_dawn.so (dawn::native::vulkan::CommandBuffer::RecordRenderPass(dawn::native::vulkan::CommandRecordingContext*, dawn::native::BeginRenderPassCmd*, dawn::native::RenderPassResourceUsage const&, dawn::detail::TypedIntegerImpl<dawn::native::PassIndexT, unsigned int>)+208) (BuildId: 0fc9db919b3e4f74e7394d5817f46e8d1bb139eb)
#05 pc 000000000089c78c  <app>/lib/arm64/libwebgpu_dawn.so (dawn::native::vulkan::CommandBuffer::RecordCommands(dawn::native::vulkan::CommandRecordingContext*)+2952) (BuildId: 0fc9db919b3e4f74e7394d5817f46e8d1bb139eb)
#06 pc 00000000008c1920  <app>/lib/arm64/libwebgpu_dawn.so (dawn::native::vulkan::Queue::SubmitImpl(dawn::detail::SpanBase<dawn::native::CommandBufferBase* const, unsigned long, dawn::native::CommandBufferBase* const*, 18446744073709551615ul>)+76) (BuildId: 0fc9db919b3e4f74e7394d5817f46e8d1bb139eb)
#07 pc 00000000007e0140  <app>/lib/arm64/libwebgpu_dawn.so (dawn::native::QueueBase::SubmitInternal(dawn::detail::SpanBase<dawn::native::CommandBufferBase* const, unsigned long, dawn::native::CommandBufferBase* const*, 18446744073709551615ul>)+180) (BuildId: 0fc9db919b3e4f74e7394d5817f46e8d1bb139eb)
#08 pc 00000000007dffc8  <app>/lib/arm64/libwebgpu_dawn.so (dawn::native::QueueBase::APISubmit(dawn::detail::SpanBase<dawn::native::CommandBufferBase* const, unsigned long, dawn::native::CommandBufferBase* const*, 18446744073709551615ul>)+60) (BuildId: 0fc9db919b3e4f74e7394d5817f46e8d1bb139eb)
#09 pc 000000000070fad0  <app>/lib/arm64/libwebgpu_dawn.so (dawn::native::NativeQueueSubmit(WGPUQueueImpl*, unsigned long, WGPUCommandBufferImpl* const*)+76) (BuildId: 0fc9db919b3e4f74e7394d5817f46e8d1bb139eb)
#10 pc 0000000000b8ce98  <app>/lib/arm64/librnskia.so (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#11 pc 0000000000b4fd00  <app>/lib/arm64/librnskia.so (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#12 pc 0000000000b0ef18  <app>/lib/arm64/librnskia.so (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#13 pc 0000000000566410  <app>/lib/arm64/librnskia.so (RNSkia::DawnContext::insertRecordings(std::__ndk1::vector<skgpu::graphite::Recording*, std::__ndk1::allocator<skgpu::graphite::Recording*>> const&, SkSurface*)+268) (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#14 pc 0000000000766a60  <app>/lib/arm64/librnskia.so (RNSkia::DawnWindowContext::presentRecordings(std::__ndk1::vector<skgpu::graphite::Recording*, std::__ndk1::allocator<skgpu::graphite::Recording*>> const&)+276) (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#15 pc 0000000000565194  <app>/lib/arm64/librnskia.so (RNSkia::RNSkView::present(std::__ndk1::shared_ptr<RNSkia::RNSkCanvasProvider> const&, RNSkia::RNSkGraphiteTargetInfo const&, std::__ndk1::vector<std::__ndk1::shared_ptr<RNSkia::RNSkGraphiteRecording>, std::__ndk1::allocator<std::__ndk1::shared_ptr<RNSkia::RNSkGraphiteRecording>>> const&, bool)+816) (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#16 pc 000000000056d950  <app>/lib/arm64/librnskia.so (RNSkia::RNSkView::presentFrame()+180) (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#17 pc 000000000056d7a0  <app>/lib/arm64/librnskia.so (facebook::jni::detail::MethodWrapper<bool (RNSkia::JniSkiaView::*)(), &RNSkia::JniSkiaView::presentFrame(), RNSkia::JniSkiaView, bool>::dispatch(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniSkiaView, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>)+60) (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#18 pc 000000000056d6e0  <app>/lib/arm64/librnskia.so (facebook::jni::detail::FunctionWrapper<bool (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniSkiaView, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>), facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniSkiaView, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*, bool>::call(_JNIEnv*, _jobject*, bool (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniSkiaView, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>))+60) (BuildId: 7514b697d7aa944656d92a3aa6db9b106476ceff)
#19 pc 00000000002e3af0  /system/framework/arm64/boot.oat (art_jni_trampoline+112) (BuildId: 996d3c4c9c2888c7d24854069ac660e07891dfea)
#20 pc 0000000000669380  /apex/com.android.art/lib64/libart.so (nterp_helper+4016) (BuildId: 7087b2f2160bfbf3335d54ba9779e325)
#21 pc 00000000002cf52e  <app>/base.apk (offset 0x1481000) (com.reactnative.skia.SkiaView.doFrame+6)
#22 pc 0000000000675908  /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doCallbacks+1064) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#23 pc 00000000006767f0  /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doFrame+2640) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#24 pc 0000000000673da0  /system/framework/arm64/boot-framework.oat (android.view.Choreographer$FrameDisplayEventReceiver.run+304) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#25 pc 00000000004dcea4  /system/framework/arm64/boot-framework.oat (android.os.Handler.dispatchMessage+68) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#26 pc 0000000000550570  /system/framework/arm64/boot-framework.oat (android.os.Looper.loopOnce+3248) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#27 pc 000000000054f844  /system/framework/arm64/boot-framework.oat (android.os.Looper.loop+244) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#28 pc 0000000000272498  /system/framework/arm64/boot-framework.oat (android.app.ActivityThread.main+1560) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#29 pc 00000000002ab060  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 7087b2f2160bfbf3335d54ba9779e325)
#30 pc 00000000002a11a0  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+552) (BuildId: 7087b2f2160bfbf3335d54ba9779e325)
#31 pc 00000000005ac718  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+32) (BuildId: 7087b2f2160bfbf3335d54ba9779e325)
#32 pc 00000000002e2a24  /system/framework/arm64/boot.oat (art_jni_trampoline+116) (BuildId: 996d3c4c9c2888c7d24854069ac660e07891dfea)
#33 pc 000000000084a59c  /system/framework/arm64/boot-framework.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+108) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#34 pc 000000000085197c  /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+3084) (BuildId: a6247b1a08fcd9255a53d6b6e85c7491ae823080)
#35 pc 00000000002ab060  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 7087b2f2160bfbf3335d54ba9779e325)
#36 pc 00000000002a9d4c  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+876) (BuildId: 7087b2f2160bfbf3335d54ba9779e325)
#37 pc 000000000060b5ac  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+184) (BuildId: 7087b2f2160bfbf3335d54ba9779e325)
#38 pc 0000000000129fd4  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+108) (BuildId: dc3467850a51b32e1af0fff33dbdedeb)
#39 pc 0000000000151744  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+916) (BuildId: dc3467850a51b32e1af0fff33dbdedeb)
#40 pc 000000000000459c  /system/bin/app_process64 (main+1244) (BuildId: ef2ab7f05e4968e970850062d5b60aed)
#41 pc 0000000000069a24  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+124) (BuildId: 0669c520dd58ab0634801cae537d6b06)

Dawn selected Vulkan / Adreno (TM) 830. The reported Vulkan driver version was 0800.64.7, with driver build f61dec9117 / I68b0a64d7e and shader compiler E031.47.18.50. These are driver version identifiers, not unique device identifiers.

ryuhzk avatar Oct 07 '26 03:10 ryuhzk

This has been fixed by #4177

wcandillon avatar Oct 16 '26 10:10 wcandillon