syncthing / syncthing-android

Wrapper of syncthing for Android.
https://syncthing.net/
Mozilla Public License 2.0
3.6k stars 404 forks source link

Syncthing getting killed by ActivityManager when started using Intent #1247

Closed dovydasvenckus closed 5 years ago

dovydasvenckus commented 6 years ago

When I start Syncthing from MacroDroid or Automate using intent, Syncthing starts, but it gets killed after about 5 seconds.

11-27 00:18:45.238  1338  1367 W ActivityManager: Bringing down service while still waiting for start foreground: ServiceRecord{2520e9 u0 com.nutomic.syncthingandroid/.service.SyncthingService}
11-27 00:18:45.251 17708 17708 V SyncthingService: onDestroy
11-27 00:18:45.251 17708 17708 V RunConditionMonitor: Shutting down
11-27 00:18:45.252 17708 17708 V ReceiverManager: Unregistered receiver: com.nutomic.syncthingandroid.service.RunConditionMonitor$NetworkReceiver@e94038f
11-27 00:18:45.253 17708 17708 V ReceiverManager: Unregistered receiver: com.nutomic.syncthingandroid.service.RunConditionMonitor$BatteryReceiver@7339225
11-27 00:18:45.253 17708 17708 V ReceiverManager: Unregistered receiver: com.nutomic.syncthingandroid.service.RunConditionMonitor$PowerSaveModeChangedReceiver@35749ab
11-27 00:18:45.253 17708 17708 I SyncthingService: Shutting down syncthing binary immediately
11-27 00:18:45.253 17708 17708 I SyncthingService: Shutting down background service
11-27 00:18:45.253 17708 17708 V SyncthingService: onServiceStateChange: from ACTIVE to DISABLED
11-27 00:18:45.253 17708 17708 D EventProcessor: Stopping event processor.
11-27 00:18:45.258  3737  3985 D StreamDBQueue: Promised revision #1198816 to queue a new op
11-27 00:18:45.258  3737  3985 D BaseStreamManager: Promised remove @ r#1198816 for StreamItemIdAndRevision{notifKey=0|com.nutomic.syncthingandroid|1|null|10104, packageName=com.nutomic.syncthingandroid, id=1, revision=0, originalRevision=0, updateCount=0} (@1198815): SBN removed: StreamItemIdAndRevision{notifKey=0|com.nutomic.syncthingandroid|1|null|10104, packageName=com.nutomic.syncthingandroid, id=1, revision=0, originalRevision=0, updateCount=0}
11-27 00:18:45.261  2378  2378 D StatusBar: updateMediaMetaData: hasArtwork = true, 0, false, true, 8, false, false, false, 0, false
11-27 00:18:45.261  3737  3988 D NewStreamAdapter: Publishing revision #1198816 to adapter clients
11-27 00:18:45.261  8704  8704 D NotificationListener: onNotificationRemoved# hash: 47252901 sbn: StatusBarNotification(pkg=com.nutomic.syncthingandroid user=UserHandle{0} id=1 tag=null key=0|com.nutomic.syncthingandroid|1|null|10104: Notification(channel=01_syncthing_persistent pri=-2 contentView=null vibrate=null sound=null defaults=0x0 flags=0xa color=0x00000000 vis=PRIVATE))
11-27 00:18:45.279  1338  1367 E OHPD    : [BgDetect] AppForkedProc mdss_fb0 pid 17224 uid 0 can't find pkgName
11-27 00:18:45.285  1338  1367 I zygote64: libdebuggerd_client: started dumping process 17708
11-27 00:18:45.286  1002  1002 I /system/bin/tombstoned: registered intercept for pid 17708 and type kDebuggerdJavaBacktrace
11-27 00:18:45.286 17708 17726 I zygote64: Thread[3,tid=17726,WaitingInMainSignalCatcherLoop,Thread*=0x6f340c4400,peer=0x12cc0088,"Signal Catcher"]: reacting to signal 3
11-27 00:18:45.286 17708 17726 I zygote64: 
11-27 00:18:45.287 17708 17726 E zygote64: # HandleSigQuit # DumpForSigQuit # before # pid=17708
11-27 00:18:45.295 17708 17708 V SyncthingRunnable: getSyncthingPIDs: Found process PID [18057]
11-27 00:18:45.297 17708 17708 D SyncthingUtil: runShellCommand: kill -SIGINT 18057
11-27 00:18:45.331 17708 18048 I SyncthingRunnable: Syncthing exited with code 0
11-27 00:18:45.336 17708 18058 I SyncthingNativeCode: [NCA53] INFO: Exiting
11-27 00:18:45.346 17708 17726 E zygote64: # HandleSigQuit # DumpForSigQuit # after # pid=17708
11-27 00:18:45.347  1002  1002 I /system/bin/tombstoned: received crash request for pid 17708
11-27 00:18:45.347  1002  1002 I /system/bin/tombstoned: found intercept fd 512 for pid 17708 and type kDebuggerdJavaBacktrace
11-27 00:18:45.347 17708 17726 I zygote64: Wrote stack traces to '[tombstoned]'
11-27 00:18:45.348  1338  1367 I zygote64: libdebuggerd_client: done dumping process 17708
11-27 00:18:45.349  1338  1367 E ActivityManager: ANR in com.nutomic.syncthingandroid
11-27 00:18:45.349  1338  1367 E ActivityManager: PID: 17708
11-27 00:18:45.349  1338  1367 E ActivityManager: Reason: Context.startForegroundService() did not then call Service.startForeground()
11-27 00:18:45.349  1338  1367 E ActivityManager: Load: 0.0 / 0.0 / 0.0
11-27 00:18:45.349  1338  1367 E ActivityManager: CPU usage from 28819ms to 0ms ago (2018-11-27 00:18:16.423 to 2018-11-27 00:18:45.242):
11-27 00:18:45.349  1338  1367 E ActivityManager:   10% 1338/system_server: 7.5% user + 2.9% kernel / faults: 9641 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   8% 11381/com.google.android.gms: 6.2% user + 1.8% kernel / faults: 4804 minor 1 major
11-27 00:18:45.349  1338  1367 E ActivityManager:   7.8% 821/surfaceflinger: 4.3% user + 3.4% kernel / faults: 50 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   4.9% 593/logd: 1% user + 3.9% kernel / faults: 9 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   4.6% 16018/adbd: 0.4% user + 4.2% kernel / faults: 7599 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   3.8% 2378/com.android.systemui: 2.8% user + 1% kernel / faults: 5796 minor 2 major
11-27 00:18:45.349  1338  1367 E ActivityManager:   3.5% 17585/com.android.chrome:sandboxed: 2.5% user + 1% kernel / faults: 1463 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   1.6% 782/android.hardware.graphics.composer@2.1-service: 0.9% user + 0.6% kernel / faults: 12 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   1.6% 14292/kworker/u16:9: 0% user + 1.6% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   1.6% 16735/kworker/u16:2: 0% user + 1.6% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   1.3% 369/kworker/u17:0: 0% user + 1.3% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   1.3% 16765/kworker/u16:13: 0% user + 1.3% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   1% 3035/com.google.android.gms.persistent: 0.7% user + 0.3% kernel / faults: 1195 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.9% 5397/kworker/u17:1: 0% user + 0.9% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.8% 29560/com.android.vending: 0.7% user + 0% kernel / faults: 2216 minor 1 major
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.8% 17224/mdss_fb0: 0% user + 0.8% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.7% 8704/net.oneplus.launcher: 0.7% user + 0% kernel / faults: 2596 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 16760/kworker/u16:5: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.6% 99/system: 0% user + 0.6% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.5% 16718/kworker/3:0: 0% user + 0.5% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.4% 279/kgsl_worker_thr: 0% user + 0.4% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.3% 16184/kworker/3:2: 0% user + 0.3% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.3% 81/smem_native_rpm: 0% user + 0.3% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.3% 563/ueventd: 0.2% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.3% 787/android.hardware.sensors@1.0-service: 0.2% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.2% 781/android.hardware.graphics.allocator@2.0-service: 0% user + 0.2% kernel / faults: 53 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.2% 1014/android.hardware.biometrics.fingerprint@2.1-service: 0% user + 0.2% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.2% 4571/com.google.process.gservices: 0.1% user + 0% kernel / faults: 276 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.2% 552/irq/289-synapti: 0% user + 0.2% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 669/zygote64: 0% user + 0.1% kernel / faults: 699 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 578/jbd2/sda13-8: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 785/android.hardware.memtrack@1.0-service: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 1241/msm_irqbalance: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 2803/com.android.phone: 0.1% user + 0% kernel / faults: 21 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 3665/android.process.media: 0.1% user + 0% kernel / faults: 335 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 7/rcu_preempt: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 22/ksoftirqd/2: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 29/ksoftirqd/3: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 32/rcuop/3: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 594/servicemanager: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 668/netd: 0% user + 0.1% kernel / faults: 189 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 792/android.hardware.wifi@1.0-service: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 2364/com.google.android.inputmethod.latin: 0% user + 0% kernel / faults: 24 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0.1% 16197/kworker/0:4: 0% user + 0.1% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 3/ksoftirqd/0: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 10/rcuop/0: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 25/rcuop/2: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 139/kswapd0: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 178/vsync_retire_wo: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 459/cfinteractive: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 799/vendor.qti.hardware.perf@1.0-service: 0% user + 0% kernel / faults: 20 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 803/healthd: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 820/lmkd: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 3175/irq/40-1008000.: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 3737/com.google.android.wearable.app:background: 0% user + 0% kernel / faults: 56 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 11761/com.alibaba.aliexpresshd: 0% user + 0% kernel / faults: 10 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 13100/kworker/2:1: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 13275/kworker/2:3: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 16791/kworker/1:2: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 25288/kworker/0:0: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 27382/cds_mc_thread: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 31434/com.trello: 0% user + 0% kernel / faults: 13 minor
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 15/ksoftirqd/1: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 18/rcuop/1: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 39/rcuop/4: 0% user + 0% kernel
11-27 00:18:45.349  1338  1367 E ActivityManager:   0% 80/dsps_smem_glink: 0% user + 0% ker
11-27 00:18:45.351  1338  1367 I ActivityManager: Killing 17708:com.nutomic.syncthingandroid/u0a104 (adj 0): bg anr
11-27 00:18:45.352  1338  1369 W zygote64: kill(-17708, 9) failed: No such process
11-27 00:18:45.363  1338  1367 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
11-27 00:18:45.363  1338  1367 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
11-27 00:18:45.372  1338 18096 D DropBoxManagerService: file :: /data/system/dropbox/data_app_anr@2018-11-27-00_18_45_361.txt.gz
11-27 00:18:45.363  1338  1369 I chatty  : uid=1000(system) ActivityManager identical 2 lines
11-27 00:18:45.370  1338  1369 W zygote64: kill(-17708, 9) failed: No such process
11-27 00:18:45.375  1338  1354 D EmbryoManager: prepare com.nutomic.syncthingandroid user 0
11-27 00:18:45.375  1338  1369 W zygote64: kill(-17708, 9) failed: No such process
11-27 00:18:45.376  1338  1354 D ActivityManager: Process com.nutomic.syncthingandroid has 0 services
11-27 00:18:45.381  1338  1369 W zygote64: kill(-17708, 9) failed: No such process
11-27 00:18:45.381  1338  1369 I zygote64: Successfully killed process cgroup uid 10104 pid 17708 in 28ms

Version Information

App Version: 0.10.15
Syncthing Version: v0.14.51
Android Version: Android 8.1 / OxtgenOS 5.1.7
Nutomic commented 5 years ago

Looks like you didn't include the important part of the log (before the part you posted). Are you using any run conditions that are not met?

AudriusButkevicius commented 5 years ago

Yeah, from the logs it looks like the run conditions are not met hence it exits.

dovydasvenckus commented 5 years ago

@AudriusButkevicius I don't think so. Conditions are met.

11-27 00:18:40.241 17708 17708 V RunConditionMonitor: Created new instance
11-27 00:18:40.245 17708 17708 V ReceiverManager: Registered receiver: com.nutomic.syncthingandroid.service.RunConditionMonitor$NetworkReceiver@e94038f with filter: android.content.IntentFilter@db5461c
11-27 00:18:40.248 17708 17708 V ReceiverManager: Registered receiver: com.nutomic.syncthingandroid.service.RunConditionMonitor$BatteryReceiver@7339225 with filter: android.content.IntentFilter@51aaffa
11-27 00:18:40.251 17708 17708 V ReceiverManager: Registered receiver: com.nutomic.syncthingandroid.service.RunConditionMonitor$PowerSaveModeChangedReceiver@35749ab with filter: android.content.IntentFilter@9dea808
11-27 00:18:40.255 17708 17708 V RunConditionMonitor: handleWifiWhitelist: !prefWifiWhitelistEnabled
11-27 00:18:40.255 17708 17708 V RunConditionMonitor: decideShouldRun: prefRunOnWifi && isWifiOrEthernetConnection && !prefRunOnMeteredWifi && !isMeteredNetworkConnection && wifiWhitelistConditionMet
11-27 00:18:40.256 17708 17708 I SyncthingService: shouldRun decision changed to true according to configured run conditions.
11-27 00:18:40.256 17708 17708 I SyncthingService: Shutting down background service
11-27 00:18:40.256 17708 17708 V SyncthingService: onServiceStateChange: from DISABLED to INIT
11-27 00:18:40.258 17708 17708 V SyncthingService: Starting syncthing
11-27 00:18:40.258 17708 17708 V SyncthingService: onServiceStateChange: from INIT to STARTING

This issue is solved in @Catfriend1 fork. https://github.com/Catfriend1/syncthing-android/pull/79#issuecomment-441976593

AudriusButkevicius commented 5 years ago

Reopening, as I guess something is wrong.