react / react/react-native

App Crashes on Exception on Non-critical Path (C++ Exception)

Đang mở
#51,664 0 bình luận 2 reaction 0 người được giao Xem trên GitHub

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

Issue: Author Provided Repro
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

Soft exception thrown in callbacks, e.g., setTimeout incurs a crash. In the reported core dump the signature is "C++ Exception".

Scope:

  • Uncontrolled exception in callbacks passed in to setTimeout, <Pressable>, etc;
  • Above crashes exist also in less defensive 3rd party libs (extended scope);
  • Incidents are also found in ReactFabric::extractEvents.
Steps to reproduce

Code below crashes app 10 secs after bootstrap:

setTimeout(() => {throw new Error('SWW')}, 10000);

Comparable throws in a <Pressable>, etc., can easily reproduce.

React Native Version

0.77.2, 0.79.2

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info
System:
  OS: macOS 15.4
  CPU: (8) arm64 Apple M1 Pro
  Memory: 135.81 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.1
    path: ~/.nvm/versions/node/v20.19.1/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v20.19.1/bin/npm
  Watchman:
    version: 2025.04.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/holmes/.rvm/gems/ruby-3.2.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.12816248
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /usr/bin/javac
  Ruby:
    version: 3.2.0
    path: /Users/holmes/.rvm/rubies/ruby-3.2.0/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.2
    wanted: 0.79.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
terminating due to uncaught exception of type facebook::jsi::JSError: ExceptionsManager.reportException raised an exception: Unhandled JS Exception: Error: SWW, js engine: hermes, stack:
anonymous@49376:19
Error: ExceptionsManager.reportException raised an exception: Unhandled JS Exception: Error: SWW, js engine: hermes, stack:
anonymous@49376:19
CoreSimulator 1010.10 - Device: iPhone 16 Pro (A124ADE1-D75C-4F48-A913-0C72B0BC212A) - Runtime: iOS 18.0 (22A3351) - DeviceType: iPhone 16 Pro
MANDATORY Reproducer

https://github.com/ehsemloh/crash-cpp-excetpion

Screenshots and Videos

https://drive.google.com/file/d/1fyPmGmg6MdMOXZHYrm0voWaMNtnmlUOZ/view?usp=sharing

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 bằng cách chạy trình tái hiện bắt buộc và theo dõi đường đi của callback từ setTimeout hoặc Pressable qua ExceptionsManager.reportException. So sánh đường đi đó với các sự cố được đề cập trong ReactFabric::extractEvents; hoàn tất khi trình tái hiện không còn kết thúc ứng dụng iOS do một exception từ callback không quan trọng.

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, javascript, react-native
Lĩnh vực
mobile, mobile-dev
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ 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.