Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Sample Application New Architecture Crash with RN 0.75 when profiling is enabled #4188

Open
antonis opened this issue Oct 17, 2024 · 2 comments · May be fixed by #4207
Open

Android Sample Application New Architecture Crash with RN 0.75 when profiling is enabled #4188

antonis opened this issue Oct 17, 2024 · 2 comments · May be fixed by #4207

Comments

@antonis
Copy link
Collaborator

antonis commented Oct 17, 2024

What React Native libraries do you use?

RN New Architecture, Hermes

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.0.0

How does your development environment look like?

info Fetching system and libraries information...

System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 257.28 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.20.4
path: ~/.nvm/versions/node/v18.20.4/bin/node
Yarn:
version: 3.6.4
path: ~/.nvm/versions/node/v18.20.4/bin/yarn
npm:
version: 10.7.0
path: ~/.nvm/versions/node/v18.20.4/bin/npm
Watchman:
version: 2024.09.09.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/antonis/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.0
- iOS 18.0
- macOS 15.0
- tvOS 18.0
- visionOS 2.0
- watchOS 11.0
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2411.12169540
Xcode:
version: 16.0/16A242d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.8
path: /opt/homebrew/opt/openjdk@17/bin/javac
Ruby:
version: 3.3.0
path: /Users/antonis/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.75.4
wanted: 0.75.4
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false

Sentry.init()

See https://github.com/getsentry/sentry-react-native/blob/6.0.0/samples/react-native/src/App.tsx#L47

Steps to Reproduce

  1. Run the Sentry sample app on Android
  2. Observe the app crashing after a few interactions (emulator) or immediately (on an actual device).
Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xf9ffffffffffd0 in tid 28855 (pool-2-thread-1), pid 28724 (ctnative.sample)
Cmdline: io.sentry.reactnative.sample
  pid: 28724, tid: 28855, name: pool-2-thread-1  >>> io.sentry.reactnative.sample <<<
       #00 pc 00000000001cf690  /data/app/~~L28pDt3h9E04FIXseGByHQ==/io.sentry.reactnative.sample-7ncgwSgsy4tLasRHD0YOSw==/base.apk!libhermes.so (offset 0x1918000) (BuildId: db078b0afc73e2129f8850376d84ff09ee5dcf01)
        #01 pc 00000000001d4168  /data/app/~~L28pDt3h9E04FIXseGByHQ==/io.sentry.reactnative.sample-7ncgwSgsy4tLasRHD0YOSw==/base.apk!libhermes.so (offset 0x1918000) (BuildId: db078b0afc73e2129f8850376d84ff09ee5dcf01)
        #02 pc 00000000001d3b0c  /data/app/~~L28pDt3h9E04FIXseGByHQ==/io.sentry.reactnative.sample-7ncgwSgsy4tLasRHD0YOSw==/base.apk!libhermes.so (offset 0x1918000) (BuildId: db078b0afc73e2129f8850376d84ff09ee5dcf01)
  Package [io.sentry.reactnative.sample] reported as REPLACED, but missing application info. Assuming REMOVED.
  1. Disable profiling by commenting out the profilesSampleRate
  2. Run the app and verify that there is no crash.

Expected Result

No crash with profiling enabled

Actual Result

The app crashes when profiling is enabled.

Notes

@antonis
Copy link
Collaborator Author

antonis commented Oct 18, 2024

Noting that I wasn't able to reproduce the crash with a basic RN 0.75.4 RN app with profiling enabled.

Project setup

npx @react-native-community/cli init AwesomeProject --version 0.75.4
cd AwesomeProject
npx @sentry/wizard@latest -i reactNative

Set newArchEnabled=true in android/gradle.properties

Sentry initialisation

Sentry.init({
  ...
  tracesSampleRate: 1.0,
  profilesSampleRate: 1.0,
});

@antonis antonis self-assigned this Oct 18, 2024
@antonis antonis moved this from Needs Discussion to In Progress in Mobile & Cross Platform SDK Oct 18, 2024
@antonis
Copy link
Collaborator Author

antonis commented Oct 22, 2024

Adding the ndk-stack of the investigated crash:

(offset 0x42b8000) (BuildId: db078b0afc73e2129f8850376d84ff09ee5dcf01)
hermes::vm::HermesValue::getTag() const
/__w/react-native/react-native/packages/react-native/sdks/hermes/include/hermes/VM/HermesValue.h:224:27
hermes::vm::HermesValue::isObject() const
/__w/react-native/react-native/packages/react-native/sdks/hermes/include/hermes/VM/HermesValue.h:408:12
hermes::vm::StackFramePtrT::getCalleeCodeBlock(hermes::vm::Runtime&) const
/__w/react-native/react-native/packages/react-native/sdks/hermes/include/hermes/VM/StackFrame-inline.h:31:11
hermes::vm::SamplingProfiler::walkRuntimeStack(hermes::vm::SamplingProfiler::StackTrace&, hermes::vm::SamplingProfiler::InLoom, unsigned int)
/__w/react-native/react-native/packages/react-native/sdks/hermes/lib/VM/Profiler/SamplingProfiler.cpp:85:35
(offset 0x42b8000) (BuildId: db078b0afc73e2129f8850376d84ff09ee5dcf01)
hermes::vm::sampling_profiler::Sampler::walkRuntimeStack(hermes::vm::SamplingProfiler*)
/__w/react-native/react-native/packages/react-native/sdks/hermes/lib/VM/Profiler/SamplingProfilerSampler.cpp:131:17
(offset 0x42b8000) (BuildId: db078b0afc73e2129f8850376d84ff09ee5dcf01)
hermes::vm::sampling_profiler::(anonymous namespace)::SamplerPosix::profilingSignalHandler(int)
/__w/react-native/react-native/packages/react-native/sdks/hermes/lib/VM/Profiler/SamplingProfilerPosix.cpp:228:21

The above would indicate that the error occurs in profiler sampling of the latest Hermes.
Changing the Sentry profiler sampling we notice that:

@antonis antonis linked a pull request Oct 30, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Review
Development

Successfully merging a pull request may close this issue.

1 participant