Skip to content

RNSkPlatformContext crashes the app on abrupt destruction when applying an OTA with expo-updates #3435

@renanmav

Description

@renanmav

Description

When rendering something on screen using react-native-skia (in my case, a <Spinner />) while applying an OTA using expo-updates, the app crashes with EXC_BAD_ACCESS (SIGSEGV).

Most relevant stack trace of the crash:

Thread 0 name:
Thread 0 Crashed:
0 0x00000001033889dc facebook::jsi::Object::Object(facebook::jsi::Runtime&) + 4 (jsi.h:909)
1 0x00000001033889dc RNJsi::ViewProperty::ViewProperty<std::__1::shared_ptr<RNSkia::RNSkPlatformContext>>(facebook::jsi::Runtime&, facebook::jsi::Value const&, std::__1::shared_ptr<RNSkia::RNSkPlatformContext>, unsigne... + 44 (ViewProperty.h:36)
2 0x000000010307dcd0 std::__1::__function::__value_func<void (int, int)>::operator()[abi:ne200100](int&&, int&&) const + 28 (function.h:436)
3 0x000000010307dcd0 std::__1::function<void (int, int)>::operator()(int, int) const + 48 (function.h:995)
4 0x0000000103418d9c RNSkia::RNSkPictureRenderer::performDraw(std::__1::shared_ptr<RNSkia::RNSkCanvasProvider>) + 136 (RNSkPictureView.h:74)
5 0x0000000103418ca0 RNSkia::RNSkPictureRenderer::renderImmediate(std::__1::shared_ptr<RNSkia::RNSkCanvasProvider>) + 56 (RNSkPictureView.h:51)
6 0x000000010341b70c RNSkia::RNSkView::redraw() + 72 (RNSkView.h:178)
7 0x000000010341b668 -[SkiaUIView drawRect:] + 56 (SkiaUIView.mm:134)

I suspect the bug lies within RNSkPlatformContext destructor.

https://github.com/Shopify/react-native-skia/blob/v2.2.18/packages/skia/cpp/rnskia/RNSkPlatformContext.h#L49

It doesn't call stopDrawLoop like it did on #1153

React Native Skia Version

2.2.18

React Native Version

0.81.4

Using New Architecture

  • Enabled

Steps to Reproduce

  1. Have an Expo app with SDK 54 installed.
  2. Display something animated on screen using react-native-skia
  3. Check if OTA is available, and fetch update bundle
  4. Call await Updates.reloadAsync
  5. Crash

Snack, Code Example, Screenshot, or Link to Repository

I've got this crash report from a Testflight user:

I will put up a GitHub repo trying to repro this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions