beagle
beagle copied to clipboard
Blank Dark Screen After force crashing
I tried to test force crash by throwing a forced exception. It logs fine first time and shows bug report menu. But when I try to repeat the same step for second time, it is giving me blank screen after crash and in my activitylifecyclelogger I'm able to see that it is in BugActivity screen onCreate(). I have tried disabling leakcanary and it's the same case.
Is there anyway I can debug this more so that I can get more info to report the bug?
Hi!
That's very interesting, I would assume that, to be able to crash for a second time, you'd have to completely kill the app from recents - in which case any previous state should no longer matter. Maybe some corrupted files that the bug report screen tries to read are causing an instant crash? Few questions / ideas:
1 - Can you reproduce this issue after cleaning the app storage?
2 - Where did you force the crash? Is it in your Application class? Because when Beagle catches the exception (and your main app process dies), it will start a new app process, with a new instance of your Application class, so that it can show the BugReportActivity. As a result, if the Application class is crashing, we might have an infinite loop.
3 - Is this only happening in the newest version (2.6.2, released yesterday)? A lot of under-the-hood changes were made to the BugReportActivity, so it might be possible that this is a new problem.
4 - Can you maybe reproduce this problem in the demo app? You can simply clone this repository and build the app module. That way you'll have full debugging powers in the library classes / you can add log statements wherever you want. I'm asking because I wasn't able to reproduce the bug.
Knowing exactly what exception is thrown (unless it's an infinite loop of the process starting and crashing) would be a good first step.
Wow. Thanks for the quick reply.
I don't think it's because of 2.6.2 because I was in the previous version and hoping 2.6.2 will fix it but it didn't.
If you see in the picture attached. With great difficulty after making it crash the second time. It got stuck over there and I believe it has to do with the uncaught exception handler?
It's late night.. I'll get some sleep and see what I can do with it first thing in the morning..
I'm getting this too in the logcat.
From my research on why I'm getting black screen or getting stuck like this due to something running on main thread. Probably a crash loop?
1 - Can you reproduce this issue after cleaning the app storage? -- I can reproduce it again. I just need to repeat force crashes. Clear storage -- crash first time all good and crash it second time.. Same issue.
2 - Where did you force the crash? Is it in your Application class? Because when Beagle catches the exception (and your main app process dies), it will start a new app process, with a new instance of your Application class, so that it can show the BugReportActivity. As a result, if the Application class is crashing, we might have an infinite loop. -- Force crashed in an activity. Just threw Exception on a button click. 3 - Is this only happening in the newest version (2.6.2, released yesterday)? A lot of under-the-hood changes were made to the BugReportActivity, so it might be possible that this is a new problem. -- Nope I was not on 2.6.2 when I came across this bug. 4 - Can you maybe reproduce this problem in the demo app? You can simply clone this repository and build the app module. That way you'll have full debugging powers in the library classes / you can add log statements wherever you want. I'm asking because I wasn't able to reproduce the bug. -- It's working fine in the demo app. I have got the app installed through playstore and it's all good..
Sounds like we're in different time zones, I'll let you know if I find something while you're asleep. If not, here's one idea:
UncaughtExceptionHandler is the thing opening the BugReport screen (after writing the crash to a file). Unfortunately, if the bug report screen itself throws an exception, that might explain the black screen you see (main thread trying and failing to open the screen over and over again). I had some safeguards against this but obviously they don't work. But you should be able to see the crash log!
In Android Studio open the Device File Explorer and navigate to data/data/your.apps.package.name/files/beagleLogs/.
There, if we're lucky, you should be able to see files called crashLog_{timestamp}.txt.
If you open the most recent one, we should see what crashes exactly.
I found something interesting. I had so many log files in the provided folder. Because that's how my logging engine works in my app. So, I have deleted all files in the directory. Now it's working fine after clearing everything. Do you think it's getting stuck after a certain amount of files in the beagle logs directory? As long as you reply back it motivates me to stay up and fix this thing :) Appreciate your quick replies again.
I'll take my word back. Sounds like I'm wrong.. So it worked fine magically and later I had about 150 files.. I tried deleting them in file explorer and gave it a try to see whether this is the issue.. Sounds like it's getting stuck again..
That's the logcat
I need to force close the app after getting stuck and reopen it --> Then it's working normally.. Let me provide simple recreation steps.. I might sound confusing..
I got 101 files and after the second crash report.. It got stuck and I have force closed the app.
Now I have deleted all the files through file directory. I waited 2 seconds to make sure it's deleted.
Then I have reopened the app. Voila it works fine.
Let me know If you need more info. I think I got to a good stopping point for you to investigate. See ya later.
The normal logs are fine but I'd be curious to see the contents of one of those crashLog_* files. That should explain what's going wrong. No rush, we'll figure it out tomorrow :)
{"id":"f6RANDOM-easdas-2312-8sdadsadsa-sdas39ac0e","exception":"An operation is not implemented: App is crashed to test debug drawer tool","stacktrace":"kotlin.NotImplementedError: An operation is not implemented: App is crashed to test debug drawer tool\n\tat com.test.mobile.testpackage.ui.TestActivity$setViews$3.invoke(AppChooserActivity.kt:146)\n\tat com.test.mobile.testpackage.ui.TestActivity$setViews$3.invoke(AppChooserActivity.kt:143)\n\tat com.test.mobile.lib.extensions.ViewExtensionsKt$setSafeOnClickListener$1.invoke(ViewExtensions.kt:31)\n\tat com.test.mobile.lib.extensions.ViewExtensionsKt$setSafeOnClickListener$1.invoke(ViewExtensions.kt:30)\n\tat com.paycom.mobile.lib.view.listener.SafeClickListener.onClick(SafeClickListener.kt:11)\n\tat android.view.View.performClick(View.java:7448)\n\tat android.view.View.performClickInternal(View.java:7425)\n\tat android.view.View.access$3600(View.java:810)\n\tat android.view.View$PerformClick.run(View.java:28305)\n\tat android.os.Handler.handleCallback(Handler.java:938)\n\tat android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loop(Looper.java:223)\n\tat android.app.ActivityThread.main(ActivityThread.java:7660)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)\n","timestamp":23213213123213}
One of the crashlog_* data file.. Let me know if you need more info.
Oh okay, so it's your test crash, not something from the library :( I'll investigate more, thanks for all the info!
Oh okay, so it's your test crash, not something from the library :( I'll investigate more, thanks for all the info!
I believe some operation looping all the persisted files is the root cause of this lag. I forgot to mention that I have logs with isPersist set as true. --> This might be an important detail.