A framework for building native applications using React
Fix JNI registration bug: HermesSamplingProfiler.disable() calls enable() (#56174)
Summary: `HermesSamplingProfiler::registerNatives()` maps the JNI `"disable"` method to `HermesSamplingProfiler::enable` instead of `HermesSamplingProfiler::disable` (copy-paste bug). This means calling `HermesSamplingProfiler.disable()` from Java actually calls `enable()` again, which corrupts the sampling thread state. This causes a SIGABRT crash on Android when any profiling tool (e.g. Sentry) calls `disable()` to stop profiling: ``` Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid (hermes-sampling) Abort message: 'invalid pthread_t passed to pthread_kill' ``` The fix is a one-character change: `::enable` → `::disable`. Related issue: https://github.com/facebook/react-native/issues/56120 ## Changelog: [ANDROID] [FIXED] - Fix HermesSamplingProfiler.disable() JNI registration calling enable() instead of disable() Pull Request resolved: https://github.com/facebook/react-native/pull/56174 Test Plan: This is a copy-paste bug fix visible by code inspection. The correct `disable()` C++ implementation already exists (line 20-24, calls `hermesAPI->disableSamplingProfiler()`) — it was just never invoked due to the incorrect JNI registration. Verified in production at Expensify: with this fix applied via patch-package, the SIGABRT crash no longer occurs when Sentry Hermes profiling is enabled. Reviewed By: javache Differential Revision: D97489621 Pulled By: cortinico fbshipit-source-id: 2109040ba2a5fecf1fd5d41f541d15161af1bd8b
E
eliran goshen committed
7f2a58e46cdf0fd797aa58c6b0c8035913d34402
Parent: af11b93
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
on 3/20/2026, 5:44:30 PM