Note for me: Android 11 API 30 problem - background data is capped

Hi,

on my PixelExperience ROM (Android 11) on the Xiaomi mi8 phone, Android restricts background data about 30 seconds after turning the phone’s screen off while Syncthing is still transferring data over the network. The network throughput goes down to 0 Bytes/s and stays there until I turn the screen on again.

This is a very bad OS behaviour, both for Syncthing and Syncthing Fork. I’m now experimenting with the “extended app option” called “unlimited background data” which is by default only enabled for GPlay services and Google’s Carrier Services app.

Interesting fact: The connection of Syncthing stays connected, but no data is flowing during screen off. I did not have those problems under Android 10.

Here’s a picture, shot on the PC that syncs with the phone.

image

If I find a solution I’ll come back to this topic. This is just a note to remind myself and let others know there are issues under Android 11.

Kind regards, Catfriend1

That seems odd. I’m not aware of such restrictions on my Pixel 4a 5G which also runs Android 11.

I’ve tried multiple times and could reproduced. My throughput stalls (phone stays connected to wifi) as soon as the screen was off for 30 secs. As soon I’m turning the screen on again, my high throughput rates (20 mb/s) are back immediately. Enabling “unrestricted background data” in the Android settings did not solve the problem.

You’re also right, that’s why I mentioned the ROM… let’s hope it’s just Pixel experience rom specific.

Sounds like Doze kicking in. Did you disable battery optimizations for the app?

1 Like

Sure, because Syncthing-Fork won’t pass the welcome slides without granting disable battery optimizations.

You could force doze mode and check if it’s related to it:

1 Like

Will try it tomorrow , thanks!

@bt90 I’ve tried the commands from the linked article while my phone was powered by the computer via USB cable (required to get the adb logcat v output).

image

I could not reproduce the “data rate drop to zero”. My speed as seen from the computer’s syncthing web UI, was fine. Even turning the display off did not reproduce the problem.

image

Conclusion until now: The “throughput drop to zero” does only occur when the phone operates on battery. I’ll setup wireless ADB and retry.

I’ve now monitored the Android log wirelessly. The above statement of mine wasn’t correctly observed. I said “can still ping the phone” while it is on WiFi when the throughput stalls. That’s wrong. This was a coincident. I started to transfer the large test file again from computer to phone. Phone was on battery. I turned off the phone’s screen as the transfer of the file began with 20 MiB/sec.

Some seconds later, the ping went “timeout - timeout - timeout”. And the throughput stall was visible.

The log points to what’s happening: “Freezing user processes.” So there IS a mechanism, but I don’t know yet if it’s stock Android, PixelExperience’ Google stuff or some community enhancement.

Surprisingly, the WifiMulticast Lock should have kept the device awake and the log says, there was Syncthing port tcp 22000 communication - it wasn’t enough. Whyever. I don’t know. Maybe, we’ll solve this riddle some day or just wait what surprises Android 12 will push down on us.

08-12 13:43:46.203     0     0 I PM      : Syncing filesystems ...
08-12 13:43:46.203     0     0 I         : Start suspend monitor
08-12 13:43:46.268     0     0 W         : done.
08-12 13:43:46.279     0     0 W         : bbd_notifier going to sleep
08-12 13:43:46.279     0     0 I [SSPBBD]: bbd_suspend ++
08-12 13:43:46.300     0     0 I [SSPBBD]: bbd_suspend --
08-12 13:43:47.015     0     0 I         : Freezing user space processes ... (elapsed 0.014 seconds) done.
08-12 13:43:47.030     0     0 I         : Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
08-12 13:43:47.033     0     0 W         : Suspending console(s) (use no_console_suspend to debug)
08-12 13:43:47.072     0     0 I [kworke][5059138138803][13:43:46.356866] wlan: [17887:I:HDD] hdd_suspend_wlan: 1065: WLAN being suspended by OS
08-12 13:43:47.072     0     0 I [kworke][5059138140209][13:43:46.356939] wlan: [17887:I:HDD] hdd_enable_arp_offload: 897: ARP offload not required
08-12 13:43:47.072     0     0 I [kworke][5059138140403][13:43:46.356949] wlan: [17887:I:HDD] hdd_enable_ns_offload: 381: NS offload is not required
08-12 13:43:47.072     0     0 I [kworke][5059138141285][13:43:46.356995] wlan: [17887:I:PMO] pmo_core_is_wow_applicable: 317: lpass enabled, enabling wow
08-12 13:43:47.073     0     0 D tas2557 2-004c: tas2557_codec_suspend
08-12 13:43:47.073     0     0 D tas2557 2-004c: tas2557_runtime_suspend
08-12 13:43:47.079     0     0 I [kworke][5059138275588][13:43:46.363990] wlan: [17887:I:HDD] __wlan_hdd_bus_suspend: 797: starting bus suspend
08-12 13:43:47.079     0     0 I [kworke][5059138276300][13:43:46.364027] wlan: [17887:I:WMI] suspend type: WOW_IFACE_PAUSE_DISABLED
08-12 13:43:47.079     0     0 I [kworke][5059138281178][13:43:46.364281] wlan: [17887:I:HDD] __wlan_hdd_bus_suspend: 852: bus suspend succeeded
08-12 13:43:47.079     0     0 I [soft_i][5059138282890][13:43:46.364370] wlan: [0:E:QDF] Received initial wake up
08-12 13:43:47.086     0     0 I PM      : suspend of devices complete after 51.526 msecs
08-12 13:43:47.088     0     0 I PM      : late suspend of devices complete after 2.737 msecs
08-12 13:43:47.116     0     0 I PM      : noirq suspend of devices complete after 27.242 msecs
08-12 13:43:47.116     0     0 I         : Disabling non-boot CPUs ...
08-12 13:43:47.153     0     0 W         : IRQ6 no longer affine to CPU1
08-12 13:43:47.153     0     0 W         : IRQ18 no longer affine to CPU1
08-12 13:43:47.153     0     0 W         : IRQ113 no longer affine to CPU1
08-12 13:43:47.153     0     0 W         : IRQ141 no longer affine to CPU1
08-12 13:43:47.161     0     0 I CPU0    : update max cpu_capacity 385
08-12 13:43:47.201     0     0 I CPU6    : update max cpu_capacity 1024
08-12 13:43:47.222     0     0 W         : IRQ13 no longer affine to CPU2
08-12 13:43:47.222     0     0 W         : IRQ101 no longer affine to CPU2
08-12 13:43:47.231     0     0 I CPU0    : update max cpu_capacity 385
08-12 13:43:47.281     0     0 I CPU5    : update max cpu_capacity 1024
08-12 13:43:47.302     0     0 W         : IRQ17 no longer affine to CPU3
08-12 13:43:47.302     0     0 W         : IRQ20 no longer affine to CPU3
08-12 13:43:47.302     0     0 W         : IRQ103 no longer affine to CPU3
08-12 13:43:47.302     0     0 W         : IRQ105 no longer affine to CPU3
08-12 13:43:47.311     0     0 I CPU0    : update max cpu_capacity 385
08-12 13:43:47.341     0     0 I CPU4    : update max cpu_capacity 1024
08-12 13:43:47.361     0     0 I CPU0    : update max cpu_capacity 385
08-12 13:43:47.391     0     0 I CPU5    : update max cpu_capacity 1024
08-12 13:43:47.421     0     0 I CPU0    : update max cpu_capacity 385
08-12 13:43:47.451     0     0 I CPU6    : update max cpu_capacity 1024
08-12 13:43:47.481     0     0 I CPU0    : update max cpu_capacity 385
08-12 13:43:47.511     0     0 I CPU7    : update max cpu_capacity 1024
08-12 13:43:47.535     0     0 I suspend ns: 138151599795893	suspend cycles:    5059147022138
08-12 13:43:47.535     0     0 W GICv3   : gic_show_resume_irq: 105 triggered qcom,glink-smem-native-xprt-dsps
08-12 13:43:48.250     0     0 I         : Suspended for 0.715 seconds
08-12 13:43:48.250     0     0 W pm_system_irq_wakeup: 105 triggered qcom,glink-smem-native-xprt-dsps
08-12 13:43:48.250     0     0 I         : Start suspend monitor
08-12 13:43:48.250     0     0 I         : Enabling non-boot CPUs ...
08-12 13:43:48.251     0     0 I CPU1    : Booted secondary processor [517f803c]
08-12 13:43:48.251     0     0 W cache   : parent cpu1 should not be sleeping
08-12 13:43:48.252     0     0 I         : CPU1 is up
08-12 13:43:48.252     0     0 I CPU2    : Booted secondary processor [517f803c]
08-12 13:43:48.252     0     0 W cache   : parent cpu2 should not be sleeping
08-12 13:43:48.253     0     0 I         : CPU2 is up
08-12 13:43:48.253     0     0 I CPU3    : Booted secondary processor [517f803c]
08-12 13:43:48.253     0     0 W cache   : parent cpu3 should not be sleeping
08-12 13:43:48.254     0     0 I         : CPU3 is up
08-12 13:43:48.255     0     0 I CPU4    : Booted secondary processor [516f802d]
08-12 13:43:48.255     0     0 W cache   : parent cpu4 should not be sleeping
08-12 13:43:48.256     0     0 I         : CPU4 is up
08-12 13:43:48.256     0     0 I CPU5    : Booted secondary processor [516f802d]
08-12 13:43:48.256     0     0 W cache   : parent cpu5 should not be sleeping
08-12 13:43:48.257     0     0 I CPU2    : update max cpu_capacity 385
08-12 13:43:48.257     0     0 I CPU4    : update max cpu_capacity 1024
08-12 13:43:48.257     0     0 I         : CPU5 is up
08-12 13:43:48.257     0     0 I CPU6    : Booted secondary processor [516f802d]
08-12 13:43:48.257     0     0 W cache   : parent cpu6 should not be sleeping
08-12 13:43:48.258     0     0 I         : CPU6 is up
08-12 13:43:48.258     0     0 I CPU7    : Booted secondary processor [516f802d]
08-12 13:43:48.259     0     0 W cache   : parent cpu7 should not be sleeping
08-12 13:43:48.260     0     0 I         : CPU7 is up
08-12 13:43:48.262     0     0 I PM      : noirq resume of devices complete after 2.029 msecs
08-12 13:43:48.265     0     0 I PM      : early resume of devices complete after 1.395 msecs
08-12 13:43:48.265     0     0 I [kworke][5059161042879][13:43:47.549787] wlan: [17139:I:HDD] __wlan_hdd_bus_resume: 1002: starting bus resume
08-12 13:43:48.267     0     0 I CPU4    : update max cpu_capacity 1024
08-12 13:43:48.269     0     0 I [soft_i][5059161125305][13:43:47.554080] wlan: [0:I:HTT] htt_get_first_packet_after_wow_wakeup: First packet after WOW Wakeup rcvd
08-12 13:43:48.270     0     0 I [soft_i][5059161133850][13:43:47.554525] wlan: [0:F:WMA] WLAN triggered wakeup: BPF_ALLOW (39), vdev: 0 (STA)
08-12 13:43:48.270     0     0 I [soft_i][5059161135204][13:43:47.554595] wlan: [0:F:WMA] WLAN wake reason counters:
08-12 13:43:48.270     0     0 I [soft_i][5059161135373][13:43:47.554604] wlan: [0:F:WMA] uc:2593 bc:0 v4_mc:21 v6_mc:0 ra:0 ns:0 na:0 icmp:0 icmpv6:0
08-12 13:43:48.270     0     0 I [soft_i][5059161135517][13:43:47.554611] wlan: [0:F:WMA] assoc:0 disassoc:0 assoc_resp:0 reassoc:0 reassoc_resp:0 auth:0 deauth:0 action:1
08-12 13:43:48.270     0     0 I [kworke][5059161135900][13:43:47.554631] wlan: [17139:I:HDD] __wlan_hdd_bus_resume: 1050: bus resume succeeded
08-12 13:43:48.270     0     0 I [soft_i][5059161135661][13:43:47.554619] wlan: [0:F:WMA] pno_match:7 pno_complete:0 gscan:0 low_rssi:0 rssi_breach:0 oem:0 scan_11d:0
08-12 13:43:48.270     0     0 I [soft_i][5059161137396][13:43:47.554709] wlan: [0:I:WMA] Src_mac: 00:1a:8c:59:12:60, Dst_mac: 48:2c:a0:73:49:9e
08-12 13:43:48.270     0     0 I [kworke][5059161137499][13:43:47.554714] wlan: [17134:I:HDD] hdd_resume_wlan: 1123: WLAN being resumed by OS
08-12 13:43:48.270     0     0 I [soft_i][5059161137748][13:43:47.554727] wlan: [0:I:WMA] WOW Wakeup: IPV4 TCP Packet rcvd
08-12 13:43:48.270     0     0 I [soft_i][5059161138552][13:43:47.554769] wlan: [0:I:WMA] Pkt_len: 1494, src_port: 22000, dst_port: 22000
08-12 13:43:48.270     0     0 I [soft_i][5059161138785][13:43:47.554781] wlan: [0:F:WMA] WLAN wake reason counters:
08-12 13:43:48.270     0     0 I [soft_i][5059161138912][13:43:47.554788] wlan: [0:F:WMA] uc:2594 bc:0 v4_mc:21 v6_mc:0 ra:0 ns:0 na:0 icmp:0 icmpv6:0
08-12 13:43:48.270     0     0 I [kworke][5059161138996][13:43:47.554792] wlan: [17134:E:HDD] hdd_disable_ns_offload: 439: Flushing of NS offload not required
08-12 13:43:48.270     0     0 I [soft_i][5059161139035][13:43:47.554794] wlan: [0:F:WMA] assoc:0 disassoc:0 assoc_resp:0 reassoc:0 reassoc_resp:0 auth:0 deauth:0 action:1
08-12 13:43:48.270     0     0 I [soft_i][5059161139168][13:43:47.554801] wlan: [0:F:WMA] pno_match:7 pno_complete:0 gscan:0 low_rssi:0 rssi_breach:0 oem:0 scan_11d:0
08-12 13:43:48.270     0     0 I [kworke][5059161139938][13:43:47.554841] wlan: [17134:I:HDD] hdd_disable_host_offloads: 564: offload is not supported on this vdev opmode: 7
08-12 13:43:48.270     0     0 I [kworke][5059161142759][13:43:47.554988] wlan: [17139:E:WMI] Invalid length for GTK status
08-12 13:43:48.270     0     0 I [kworke][5059161142888][13:43:47.554995] wlan: [17139:E:TIF] target_if_pmo_gtk_offload_status_event: 141: Extraction of gtk rsp event failed
08-12 13:43:48.273     0     0 D tas2557 2-004c: tas2557_codec_resume
08-12 13:43:48.273     0     0 D tas2557 2-004c: tas2557_runtime_resume
08-12 13:43:48.274     0     0 I PM      : resume of devices complete after 9.473 msecs
08-12 13:43:48.276     0     0 I         : Restarting tasks ... done.
08-12 13:43:48.301     0     0 W         : bbd_notifier waking up
08-12 13:43:48.301     0     0 I Abort   : Wakeup IRQ 105 qcom,glink-smem-native-xprt-dsps pending
08-12 13:43:47.586     0     0 I PM      : suspend exit 2021-08-12 11:43:47.586454856 UTC
08-12 13:43:47.586     0     0 I         : Stop suspend monitor
08-12 13:43:47.586  1428  6397 I BatteryStatsService: In wakeup_callback: resumed from suspend
08-12 13:43:47.707     0     0 I PM      : suspend entry 2021-08-12 11:43:47.707754491 UTC
08-12 13:43:47.707     0     0 I         : Start suspend monitor
08-12 13:43:47.707     0     0 I PM      : Syncing filesystems ... done.
08-12 13:43:47.844     0     0 W         : bbd_notifier going to sleep
08-12 13:43:47.844     0     0 I [SSPBBD]: bbd_suspend ++
08-12 13:43:47.864     0     0 I [SSPBBD]: bbd_suspend --
08-12 13:43:47.864     0     0 I         : Freezing user space processes ...

Sidenote: While I was monitoring the ADB log a little longer after the Syncthing data transfer stalled and ping was timeout - a messenger chat message arrived on my phone and it woke up for some seconds. While the messenger made beep and a short time after that, the ping was immediately back and Syncthing resumed to transfer data for a short moment.

@Catfriend1

I had a WiFi connection stall even when the phone was connected to a charger when trying to set up strelaysrv for the first time (see https://forum.syncthing.net/t/errors-when-trying-to-run-strelaysrv-for-the-first-time/16818 for details). Disabling doze did nothing. The only reliable way proved to be using the Developer Options to keep screen on when charging.

Of course, my issues were under Android 7.x, so things might have changed in between, but my observations are that Android uses many different mechanisms to limit network activity when idle. In my case, it didn’t matter whether the phone was on battery or connected to a charger. What really mattered was whether the screen was on or off.

1 Like

I can’t reproduce this on my Pixel 4a (Android 11). Neither with the official App (API 29), nor the Fork (API 30).
Even 10 Minutes after screen “off”, both App instances are downloading with ~10MB/s, as they do with active screen.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.