0xf104a / NextcloudServices

Android app to send notifications from Nextcloud without using GCM(Google cloud messaging)
GNU General Public License v3.0
63 stars 11 forks source link

ANRs on GrapheneOS #89

Open 0xf104a opened 2 months ago

0xf104a commented 2 months ago

@0x50f13 I'm still getting regular ANRs on stock GrapheneOS. I've included the logs above. Did I do it wrong? If I manually open the app the notifications come in, but it crashes in the background. I've set it to unrestricted but that didn't help.

Originally posted by @randoentity in https://github.com/0x50f13/NextcloudServices/issues/87#issuecomment-2184543423

NablaMetal commented 1 month ago

Hello, for what is worth, I guess I get the same issue also on GrapheneOS.

type: ANR
osVersion: google/panther/panther:14/AP2A.240705.004/2024080200:user/release-keys
package: com.polar.nextcloudservices:20
process: com.polar.nextcloudservices
installer: com.machiav3lli.fdroid

activity: null
cause: ANR executing service com.polar.nextcloudservices/.Services.NotificationPollService, waited 20001ms
info: ANR in com.polar.nextcloudservices
PID: 27742
Reason: executing service com.polar.nextcloudservices/.Services.NotificationPollService, waited 20001ms
ErrorId: b4ccedb6-5672-450c-82ba-a9bea487e272
Frozen: true
Timestamp: 2024-08-05 11:37:10.198+0200
Load: 5.1 / 4.43 / 3.16
----- Output from /proc/pressure/memory -----
some avg10=0.00 avg60=0.02 avg300=0.06 total=10605692
full avg10=0.00 avg60=0.00 avg300=0.00 total=5162322
----- End output from /proc/pressure/memory -----
----- Output from /proc/pressure/cpu -----
some avg10=10.27 avg60=10.45 avg300=11.11 total=4619768327
----- End output from /proc/pressure/cpu -----
----- Output from /proc/pressure/io -----
some avg10=0.00 avg60=0.08 avg300=0.12 total=32830652
full avg10=0.00 avg60=0.06 avg300=0.06 total=22326196
----- End output from /proc/pressure/io -----

CPU usage from 3ms to 13965ms later (2024-08-05 11:37:10.193 to 2024-08-05 11:37:24.155):
  25% 1361/system_server: 14% user + 11% kernel / faults: 25381 minor 491 major
  13% 1071/gpsd: 8.5% user + 5.2% kernel / faults: 2 minor 2 major
  9.2% 890/android.hardware.sensors-service.multihal: 3.9% user + 5.3% kernel
  7.7% 1946/com.android.systemui: 5.4% user + 2.2% kernel / faults: 12719 minor 399 major
  5.6% 551/surfaceflinger: 3.5% user + 2% kernel / faults: 128 minor
  5% 16267/kworker/u17:2-bcm477x_wq: 0% user + 5% kernel
  4.5% 7532/im.vector.app: 3.6% user + 0.8% kernel / faults: 1031 minor 40 major
  3.7% 27742/com.polar.nextcloudservices: 2.2% user + 1.5% kernel / faults: 24507 minor 2566 major
  3.5% 142/spi5: 0% user + 3.5% kernel
  2.4% 1066/lhd: 0.7% user + 1.7% kernel
14% TOTAL: 6% user + 6.2% kernel + 0.1% iowait + 1% irq + 0.4% softirq
CPU usage from 71ms to 472ms later (2024-08-05 11:37:10.261 to 2024-08-05 11:37:10.662):
  53% 1361/system_server: 21% user + 31% kernel / faults: 597 minor 16 major
    31% 28924/AnrAuxiliaryTas: 6.2% user + 25% kernel
    3.1% 1786/SensorService: 3.1% user + 0% kernel
    3.1% 1817/aidl_ssvc_poll: 3.1% user + 0% kernel
    3.1% 1914/shortcut: 0% user + 3.1% kernel
  9.2% 1071/gpsd: 3% user + 6.1% kernel
    6.1% 1071/main: 3% user + 3% kernel
    3% 3232/Sensor0: 0% user + 3% kernel
  5.8% 890/android.hardware.sensors-service.multihal: 0% user + 5.8% kernel
    5.8% 922/android.hardwar: 2.9% user + 2.9% kernel
    2.9% 1285/UsfTransport: 0% user + 2.9% kernel
  7.9% 16267/kworker/u17:2-ufs_clk_gating_0: 0% user + 7.9% kernel
  2.4% 12/rcu_preempt: 0% user + 2.4% kernel
  2.5% 49/rcuog/4: 0% user + 2.5% kernel
  2.5% 142/spi5: 0% user + 2.5% kernel
  2.5% 167/simpleinteracti: 0% user + 2.5% kernel
  2.9% 933/audioserver: 0% user + 2.9% kernel
  3.1% 1280/com.google.usf.: 0% user + 3.1% kernel
  4.2% 27834/kworker/3:0-memlat_wq: 0% user + 4.2% kernel
10% TOTAL: 3.7% user + 5.9% kernel + 0.6% irq + 0.3% softirq
NablaMetal commented 1 month ago

Weird, setting a polling interval of 5s seem to solve the issue. Can you test @randoentity ?

randoentity commented 1 month ago

Thanks for the mention @NablaMetal! I tried it just now and it doesn't seem to work. I get some notifications when opening NextcloudServices but new messages after closing the app don't arrive. I'd already tried a couple of different polling settings.

randoentity commented 1 month ago

Sorry for the double post, but I thought this was too relevant to miss: I tried logging in via URL+credentials instead of "log in via Nextcloud app" and now it seems to be working, even with the interval on 15 seconds!

Edit: I looked at the code a bit and it looks like it might be an issue with the SSO API. It uses AIDL. I assume GrapheneOS restricts AIDL use to processes with the same owner. When NextcloudServices in the foreground the rules seem to be less strict. It's been a long time since I touched Android development so forgive me if this is all way off.