antest1 / kcanotify

Viewer Application for KanColle Android
GNU General Public License v3.0
203 stars 29 forks source link

2.6.7r3 app crashing by itseft after idle for a while #69

Closed tossaponk closed 5 years ago

tossaponk commented 5 years ago

All of features are working properly but application crash after I turned off the screen and come back. It doesn't immediately happen but took a while for it to happen.

This is the first time I used this app so I don't know if it just this version or it happen with all version on my phone.

Android version 8.1.0 The error log is as follows

[S] 2.6.7r3 /kca/version.json java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.gson.JsonObject com.google.gson.JsonElement.getAsJsonObject()' on a null object reference / at com.antest1.kcanotify.KcaService.handleServiceMessage(KcaService.java:693) / at com.antest1.kcanotify.KcaService$kcaServiceHandler.handleMessage(KcaService.java:623) / at android.os.Handler.dispatchMessage(Handler.java:106) / at android.os.Looper.loop(Looper.java:164) / at android.app.ActivityThread.main(ActivityThread.java:6501) / at java.lang.reflect.Method.invoke(Native Method) / at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) / at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) / [B@343b96c 2019-03-05 15:08:04

antest1 commented 5 years ago

I'm checking about this issue (maybe data corruption or format changes) Thanks for the report.

tossaponk commented 5 years ago

Still crashing with rev4 with the following message

[S] 2.6.7r4 /kca/version.json java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.gson.JsonObject com.google.gson.JsonObject.getAsJsonObject(java.lang.String)' on a null object reference / at com.antest1.kcanotify.KcaService.handleServiceMessage(KcaService.java:693) / at com.antest1.kcanotify.KcaService$kcaServiceHandler.handleMessage(KcaService.java:622) / at android.os.Handler.dispatchMessage(Handler.java:106) / at android.os.Looper.loop(Looper.java:164) / at android.app.ActivityThread.main(ActivityThread.java:6501) / at java.lang.reflect.Method.invoke(Native Method) / at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) / at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) / 2019-03-12 09:24:46

antest1 commented 5 years ago

Can you send me the exported error log?

tossaponk commented 5 years ago

Here's the full log file from the last post. Excluding some sensitive info omitted from the HTML response.

https://docs.google.com/document/d/1el6GcbOqQ7mgY3zS1tn5wUuUWYgDpJJ1WkasRmJcPJ4/edit?usp=sharing

Although I experience more crash today but it was silently crashed without any error log entry.

Edit: I tried using USB debugging and obtained the following messages. It seems that the service cleanup process auto close kcanotify service when the app closes without error message.

Turned out my phone auto set the app in the power saving blacklist. I removed the app from blacklist and will test if it stops closing by itself/

2019-03-13 18:38:26.818 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanService: com.antest1.kcanotify importances [1000] 2019-03-13 18:38:26.825 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanUtil: UidRx/TotalRx: 0.00%, package: com.antest1.kcanotify 2019-03-13 18:38:26.829 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanUtil: isAppDownloading----dtTotalRx:44630 delayTime:30588 speed:1k/s package:com.antest1.kcanotify packageBt:0 2019-03-13 18:38:26.830 940-940/? W/AudioPolicyService: logGuestLocation: function:isStreamActive (1552477106830) 2019-03-13 18:38:26.831 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanUtil: isAppMonitoringLocation: com.antest1.kcanotify 2019-03-13 18:38:26.831 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanUtil: isLocationEnable: false 2019-03-13 18:38:26.832 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanService: forceStopPackage com.antest1.kcanotify 2019-03-13 18:38:26.833 1408-6811/? I/ActivityManager: Force stopping com.antest1.kcanotify appid=10171 user=0: from pid 4165 2019-03-13 18:38:26.841 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanService: total clean: 1 apps 2019-03-13 18:38:26.841 4165-4692/? D/[PowerSavingAppG3]BackgroundCleanService: background clean stop

antest1 commented 5 years ago

It seems that the silent crash problem is caused by power saving apps. As kcanotify uses VPN service for data capture, all data usage (which used for calculating battery usage) routed by kcanotify sniffer is treated as kcanotify usage.

I'm aware of the battery consumption of the kcanotify itself, I think it would be hard to reduce for a while orz

tossaponk commented 5 years ago

The auto closing finally stopped after I remove this app from blacklist manually. The reason that make me think the app is silently crashing is that I turned off battery optimization for this app but it turned out that the battery optimization and lock-screen cleanup are the separate settings.

Also from my previous comment, it seems that the crashing(the one with error message) is from an unexpected response due to the transparent proxy on the network I connected to at the time.