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

Avoid calling DeleteLocalRef for jmethodID and jfieldID pointers #1117

Merged
merged 1 commit into from
Feb 5, 2021

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Feb 4, 2021

Goal

Avoids calling DeleteLocalRef for jmethodID and jfieldID pointers, which are regular C-style pointers. Invoking this method on an Android emulator results in a SIGABRT when triggering a handled C++ error report in Bugsnag. This behaviour is not triggered on BrowserStack or physical devices, even when loading the same APK.

Testing

Ran the example app on an emulator and triggered the C++ error report, confirming that no SIGABRT was raised. This interacts with all the Bugsnag C APIs that use the JNI.

Stacktrace

SIGABRT Abort program 
    [vdso]:2756 __kernel_vsyscall
    /system/lib/libc.so:482109 tgkill
    /system/lib/libc.so:127055 abort
    /system/lib/libart.so:5442750 0xaa348cbe
    /system/lib/libart.so:5445018 art::Runtime::Aborter(char const*)
    /system/lib/libart.so:1119188 std::__1::__function::__func<void (*)(char const*), std::__1::allocator<void (*)(char const*)>, void (char const*)>::operator()(char const*&&)
    /system/lib/libart.so:6579851 android::base::LogMessage::~LogMessage()
    /system/lib/libart.so:3651923 art::JavaVMExt::JniAbort(char const*, char const*)
    /system/lib/libart.so:3652742 art::JavaVMExt::JniAbortF(char const*, char const*, ...)
    /system/lib/libart.so:5677576 art::Thread::DecodeJObject(_jobject*) const
    /system/lib/libart.so:1322721 art::ScopedCheck::CheckInstance(art::ScopedObjectAccess&, art::ScopedCheck::InstanceKind, _jobject*, bool)
    /system/lib/libart.so:1319719 art::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::JniValueType)
    /system/lib/libart.so:1317044 art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*)
    /system/lib/libart.so:1332117 art::CheckJNI::DeleteRef(char const*, _JNIEnv*, _jobject*, art::IndirectRefKind)
    /system/lib/libart.so:1230458 art::CheckJNI::DeleteLocalRef(_JNIEnv*, _jobject*)
    /data/app/com.example.bugsnag.android-ANziLEUMmj2LefWUs739eg==/lib/x86/libbugsnag-ndk.so:174337 bugsnag_leave_breadcrumb_env
    /data/app/com.example.bugsnag.android-ANziLEUMmj2LefWUs739eg==/lib/x86/libentrypoint.so:2675 Java_com_example_bugsnag_android_BaseCrashyActivity_notifyFromCXX

@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1471.68 1382.61
arm64_v8a 381.61 291.5
armeabi 361.12 271.01
armeabi_v7a 344.75 254.64
x86 422.55 332.44
x86_64 406.17 311.97

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants