Skip to content

Crash on Android 5 devices after some seconds #1211

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

Closed
Awais6 opened this issue Mar 3, 2023 · 18 comments
Closed

Crash on Android 5 devices after some seconds #1211

Awais6 opened this issue Mar 3, 2023 · 18 comments
Assignees
Labels
Bug Something isn't working Platform: Android

Comments

@Awais6
Copy link

Awais6 commented Mar 3, 2023

Environment

How do you use Sentry?
Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?) sentry.io

Which version of the SDK?
0.28.1 and 1.0.0 both have same error both tested

How did you install the package? (Git-URL, Assetstore)
git url

Which version of Unity?
2020.3.44f1 LTS

Is this happening in Unity (editor) or on a player like Android, iOS, Windows?
Confirmed Android 5.0 Devices and maybe Android 6.0 too

Steps to Reproduce

I have Google Admob + Firebase + Facebook + Photon + Sentry SDKs in the game. I removed all the SDKs one by one to find the buggy SDK, at last when I just turn off the sentry SDK app then started running smoothly. I have retested it twice with the clean build, there is some bug in Sentry SDK. It is 100% confirmed it crashes on an android 5.0 device.

Expected Result

should not crash

Actual Result

It shows in the Android Logcat:
image

@Awais6
Copy link
Author

Awais6 commented Mar 3, 2023

moreover, I am using SentryOptionsConfiguration

public override void Configure(SentryUnityOptions options)
    {
        // Your code here
        options.BeforeSend = BeforeSend;
        // options.DisableAnrIntegration();
    }

    private static SentryEvent BeforeSend(SentryEvent arg)
    {
        arg.SetTag("IsSignedIn", FireAuth.IsSignedInAndReady.ToString());
        arg.SetTag("UId", FirestoreData.SharedDocument?.userId ?? "No Id");
        arg.SetTag("Scene", SceneManager.GetActiveScene().name);
        return arg;
    }

@bitsandfoxes
Copy link
Contributor

Thanks for raising this! I'll take a look!

@bitsandfoxes bitsandfoxes added Bug Something isn't working and removed Status: Untriaged labels Mar 3, 2023
@github-project-automation github-project-automation bot moved this to Needs Discussion in [DEPRECATED] Mobile SDKs Mar 3, 2023
@bitsandfoxes
Copy link
Contributor

To isolate the cause: Can you reproduce this with native support in Tools -> Sentry -> Advanced -> Android Native Support disabled?

@bitsandfoxes bitsandfoxes moved this from Needs Discussion to Needs Investigation in [DEPRECATED] Mobile SDKs Mar 7, 2023
@bitsandfoxes
Copy link
Contributor

Hey, could you provide us with additional logcat logs? I'm very keen on taking a look at this.
Since you were already testing this extensively, could you share a repro with us?
Thanks!

@vic910
Copy link

vic910 commented Mar 15, 2023

i have same program in android 5.crash log is

03-15 10:50:01.005 W/art     ( 8652): Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[31,tid=9108,Native,Thread*=0xee8aec00,peer=0x130d20a0,"Thread-7617"]
03-15 10:50:01.005 F/art     ( 8652): art/runtime/thread.cc:1082] Native thread exited without calling DetachCurrentThread: Thread[31,tid=9108,Native,Thread*=0xee8aec00,peer=0x130d20a0,"Thread-7617"]

@vic910

This comment was marked as duplicate.

@vic910
Copy link

vic910 commented Mar 16, 2023

set Android Native Support disabled is OK

@vic910
Copy link

vic910 commented Mar 16, 2023

how disable sentry in android 5 at runtime

@bitsandfoxes
Copy link
Contributor

how disable sentry in android 5 at runtime

You can disable Sentry at runtime with the RuntimeConfiguration. You can try checking for the Android version there and set options.Enabled = false;. This prevents the SDK from initializing and shuts down the Android SDK.

@NicoWakatoon
Copy link

@bitsandfoxes I have the same problem on an Android 6 device, how can I help you to debug this issue ?

W/art: Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[23,tid=17273,Native,Thread*=0xca660000,peer=0x134220a0,"Thread-3924"]
A/art: art/runtime/thread.cc:1238] Native thread exited without calling DetachCurrentThread: Thread[23,tid=17273,Native,Thread*=0xca660000,peer=0x134220a0,"Thread-3924"]
A/art: art/runtime/runtime.cc:368] Runtime aborting...
A/art: art/runtime/runtime.cc:368] 

I exported the project to android studio to catch the exception. in the native debugger here is the stacktrace:

Screenshot 2023-08-28 at 17 15 01

Disabling Sentry at runtime on Android device <= 6 seem to fix the issue, but i'd like to be able to to catch problems old devices too.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Aug 28, 2023
@bitsandfoxes
Copy link
Contributor

Hey, thanks for the helping hand! Is this only happening on a physical device? Does this happen in the emulator too?

@NicoWakatoon
Copy link

Hi I have not tried on the emulator. if it'm important I can try it but I need to rebuilt everything to support X86 emulator

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Aug 29, 2023
@bitsandfoxes
Copy link
Contributor

That'd be hugely appreciated.

@NicoWakatoon
Copy link

Same problem using the x86 emulator ( Nexus 4 API 23 ) :

W/art: Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[22,tid=7690,Native,Thread*=0x904f3000,peer=0x12f1c0a0,"Thread-225"]
A/art: art/runtime/thread.cc:1223] Native thread exited without calling DetachCurrentThread: Thread[22,tid=7690,Native,Thread*=0x904f3000,peer=0x12f1c0a0,"Thread-225"]
I/sentry-native: entering signal handler
D/sentry-native: captured backtrace with 11 frames
D/sentry-native: merging scope into event
D/sentry-native: trying to read modules from /proc/self/maps
D/sentry-native: read 124 modules from /proc/self/maps
D/sentry-native: adding attachments to envelope
D/sentry-native: sending envelope
D/sentry-native: serializing envelope into buffer
I/sentry-native: crash has been captured
    
    --------- beginning of crash
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9c in tid 7690 (Thread-225)
Disconnected from the target VM, address: 'localhost:64606', transport: 'socket'

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Aug 31, 2023
@bitsandfoxes
Copy link
Contributor

Thanks for confirming this. I'll see what I can find out.

@packedbox
Copy link

@bitsandfoxes any update on this issue ?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 10, 2023
@bitsandfoxes
Copy link
Contributor

Unfortunately, nothing definitive. What we do have now is more granular control over what gets initialized and you can selectively disable the NDK only while keeping the rest of the Android Native support.

@bitsandfoxes
Copy link
Contributor

Thanks for all the input so far and apologies for the slow progress. We can finally reproduce this and have a lead as to how to resolve it.
I'm closing this in favor of: #1591

@github-project-automation github-project-automation bot moved this from Needs Investigation to Done in [DEPRECATED] Mobile SDKs May 14, 2024
@github-project-automation github-project-automation bot moved this to Done in GDX May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Platform: Android
Projects
Archived in project
Archived in project
Archived in project
Development

No branches or pull requests

5 participants