react / react/react-native

Getting Crash In Ios Device

Đang mở
#55,337 9 bình luận 7 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs: Attention Needs: Repro Platform: iOS
Ngôn ngữ chính
C++
Star
127k
Fork
25.3k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
4

Mô tả

Description

The app crashes on iOS in the React Native TurboModule thread (com.meta.react.turbomodulemanager.queue) while running on the Hermes JavaScript engine.

The crash occurs when a native TurboModule throws an Objective-C NSException, and React Native attempts to convert that exception into a JavaScript error. During this conversion, Hermes fails while dynamically adding a property to a JS object, leading to a fatal crash inside hermes::vm::HiddenClass::addProperty.

This indicates an issue in native-to-JS error bridging, likely caused by:

An uncaught NSException inside a TurboModule method

Invalid or unexpected data being set on a JS object from native code

Improper error handling in a custom or third-party TurboModule

Steps to reproduce

The app crashes randomly on the com.meta.react.turbomodulemanager.queue thread.

React Native Version

0.82.1

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info
System:
  OS: macOS 26.2
  CPU: (8) arm64 Apple M1
  Memory: 151.78 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 25.2.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 11.6.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2025.12.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/appinlay/.rvm/gems/ruby-3.2.2/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK:
    API Levels:
      - "31"
      - "33"
      - "34"
      - "35"
      - "35"
      - "36"
      - "36"
      - "36"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
      - 35.0.0
      - 35.0.0
      - 36.0.0
    System Images:
      - android-35 | Google APIs ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play Intel x86_64 Atom
      - android-36 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google APIs Intel x86_64 Atom
      - android-Baklava | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2513.14007798
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/appinlay/.rvm/rubies/ruby-3.2.2/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.1
    wanted: ^19.1.1
  react-native:
    installed: 0.82.1
    wanted: ^0.82.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
Crashed: com.meta.react.turbomodulemanager.queue
0  hermesvm                       0x40fa4 hermes::vm::JSObject::allocateNewSlotStorage(hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Runtime&, unsigned int, hermes::vm::Handle<hermes::vm::HermesValue>) + 488
1  hermesvm                       0x4107c hermes::vm::JSObject::allocateNewSlotStorage(hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Runtime&, unsigned int, hermes::vm::Handle<hermes::vm::HermesValue>) + 704
2  hermesvm                       0x46514 hermes::vm::JSObject::addOwnPropertyImpl(hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Runtime&, hermes::vm::SymbolID, hermes::vm::PropertyFlags, hermes::vm::Handle<hermes::vm::HermesValue>) + 224
3  hermesvm                       0x24558 hermes::vm::Callable::defineNameLengthAndPrototype(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&, hermes::vm::SymbolID, unsigned int, hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Callable::WritablePrototype, bool) + 188
4  hermesvm                       0x42d18 hermes::vm::JSObject::getNamedDescriptorUnsafe(hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Runtime&, hermes::vm::SymbolID, hermes::vm::PropertyFlags, hermes::vm::NamedPropertyDescriptor&) + 452
5  hermesvm                       0x3f73c hermes::vm::JSError::recordStackTrace(hermes::vm::Handle<hermes::vm::JSError>, hermes::vm::Runtime&, bool, hermes::vm::CodeBlock*, hermes::inst::Inst const*) + 2124
6  hermesvm                       0x93cc8 hermes::vm::constructErrorObject(hermes::vm::Runtime&, hermes::vm::NativeArgs, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::JSObject>) + 160
7  hermesvm                       0x92ac0 hermes::vm::ErrorConstructor(void*, hermes::vm::Runtime&, hermes::vm::NativeArgs) + 124
8  hermesvm                       0x25e78 hermes::vm::NativeFunction::_nativeCall(hermes::vm::NativeFunction*, hermes::vm::Runtime&) + 140
9  hermesvm                       0xa4e4 facebook::hermes::(anonymous namespace)::HermesRuntimeImpl::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 300
10 myapp                        0x3e3f48 facebook::react::TurboModuleConvertUtils::createJSRuntimeError(facebook::jsi::Runtime&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 313 (jsi-inl.h:313)
11 myapp                        0x3e0ad0 facebook::react::TurboModuleConvertUtils::convertNSExceptionToJSError(facebook::jsi::Runtime&, NSException*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 230 (RCTTurboModule.mm:230)
12 myapp                        0x3e1364 invocation function for block in facebook::react::ObjCTurboModule::performVoidMethodInvocation(facebook::jsi::Runtime&, char const*, NSInvocation*, NSMutableArray*) + 473 (RCTTurboModule.mm:473)
13 myapp                        0x3e6418 std::__1::__function::__func<facebook::react::ObjCTurboModule::performVoidMethodInvocation(facebook::jsi::Runtime&, char const*, NSInvocation*, NSMutableArray*)::$_1, std::__1::allocator<facebook::react::ObjCTurboModule::performVoidMethodInvocation(facebook::jsi::Runtime&, char const*, NSInvocation*, NSMutableArray*)::$_1>, void ()>::operator()() + 180 (TraceSection.h:180)
14 libdispatch.dylib              0x1adc _dispatch_call_block_and_release + 32
15 libdispatch.dylib              0x1b7fc _dispatch_client_callout + 16
16 libdispatch.dylib              0xa468 _dispatch_lane_serial_drain + 740
17 libdispatch.dylib              0xaf44 _dispatch_lane_invoke + 388
18 libdispatch.dylib              0x153ec _dispatch_root_queue_drain_deferred_wlh + 292
19 libdispatch.dylib              0x14ce4 _dispatch_workloop_worker_thread + 692
20 libsystem_pthread.dylib        0x13b8 _pthread_wqthread + 292
21 libsystem_pthread.dylib        0x8c0 start_wqthread + 8
MANDATORY Reproducer

The app crashes randomly on the com.meta.react.turbomodulemanager.queue thread.

Screenshots and Videos

No response

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với RCTTurboModule.mm tại convertNSExceptionToJSError và createJSRuntimeError, sau đó lần theo quá trình xây dựng Hermes Error bị lỗi được hiển thị trong stack trace. Hiện tại issue chỉ cung cấp một báo cáo crash ngẫu nhiên, vì vậy trước tiên hãy thiết lập một trường hợp TurboModule NSException có thể tái hiện trên iOS 0.82.1. Được xem là hoàn thành khi reproducer không còn crash trong quá trình chuyển đổi lỗi native thành lỗi JavaScript.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp, objective-c, react-native
Lĩnh vực
mobile
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.