Android app consumes too much battery when IDLE

Hi @Nicuh, i have tried it yesterday "restartOnWakeup " OFF, but it doesn t seam to change anything on my android 6.0. After 8H the app with nothing to sync; uses 25% of the batter (3% / hour as samsung says).

It looks like we have several battery draining causes…

My guess would be that it, while running, keeps network sockets open and sends pings over them. This prevents the CPU and cellular modem / WiFi from sleeping.

Dear @calmh, That s exactly my guess too !!! I have found that when on WIfi it uses much less power than on 4G. I believe this is because it cost much less power to send on Wifi data ALL THE TIME. On wifi syncthing uses 3% per 8 hours on 4G 25% sittinf IDLE! The battery cost of sending packets over wifi is much lower than 4G, therefore it stays unoticed for wifi users.

We need to implement something around this solution explained by android devs, it is called “BATCHING” and "SCHEDULING" https://developer.android.com/topic/performance/power/network/action-app-traffic.html

https://developer.android.com/topic/performance/power/network/index.html

Happy this issue is on the agenda

Cheers Hubyhuby

It is not on the agenda, as such. However the batching mentioned there could be implemented by the Android wrapper as something simple like pausing all devices, and then periodically:

  • unpausing
  • giving things a while to connect
  • observing sync status; if syncing, leave it connected for a little while longer
  • when all connected devices are in sync, pause all devices
2 Likes

Oh, it’s not normally this bad.

:frowning:

Paully

Google Pixel (sailfish) Android 8.1.0 Syncthing for Android 0.10.5

I think it is related to the bug in the latest version.

Or maybe not… I have the latest syncthing for Android app installed (0.10.6, with syncthing 0.14.45), and I’m still getting way too high CPU usage. The app itself says it uses less than 5% of CPU, but if I go to the app monitor, I see a usage around 20 or 25%. And I fear the monitor is right, since my battery gets drained much faster than usual if I leave syncthing running. My device is a Samsung Galaxy Note 3 with Android 5.0.

I’ve noticed high CPU and battery usage too, with Android versions 0.10.5 and 0.10.6. Not noticed a problem with precious versions.

I should explain that in my case the battery drain occurs if “Always run in background” is ticked (I also have “Run only on WiFi” ticked). Same settings prior to Android 0.10.5 didn’t have this problem as far as I know.

All my folders are synced and I also reset the database, but still the drain occurs. I have three synced folders, 7 files/400 KiB, 700 files/2.5 GiB, 6 files/180 MiB. Scan interval is 5 mins.

Huge power consume on two Xperia Z2 with latest Syncthing.

In that 30 minuttes xiia was playing internetradio.

Second Z2

I switched back to Syncthing for Android v0.10.4 via FDroid (that still has it) and the battery consumption issues are gone. Now I see CPU usage for Syncthing when idle at 0% when it was at 20~25% with the next versions… I hope this version will keep on working.

1 Like

So I’d love to fix this but I can’t repro on my pixel.

I can actually reproduce on my Samsung Galaxy S4. It drains the battery much faster than it did before without any changes to the configuration (of Syncthing or the Phone).

Maybe I can look into it, but I haven’t been developing for Android for quite a while now and I think the usage of Go makes this even harder than average. But I could gather some logs at least.

The workaround is currently to only enable the app if I want to sync something. It is ok, but far from ideal.

The consumption seems to be come from java part tho.

I haven’t expected that. So the Syncthing logs wouldn’t help much. To verify this, we could try to downgrade the Java app itself but still use the latest Syncthing binary. If the issue is gone, you’re right. Knowing the relevant part for sure would also help bisecting.

Oh, it’s happening again…

…latest Android 8.1.0 on a Google Pixel with latest Syncthing for Android app.

:frowning:

Can you specify the version, as latest has no meaning as time passes, as well as it doesn’t have meaning over multiple sources you can get the app from.

My apologies, here is the info.

Syncthing Version v0.14.46+1-g7f1c0a33

Syncthing Android Version 0.10.8

If you have shell access you should check which process is causing the CPU usage. The app or libsyncthing.so, and check the logs for issues.