BOINC / boinc

Open-source software for volunteer computing and grid computing.
https://boinc.berkeley.edu
GNU Lesser General Public License v3.0
1.99k stars 443 forks source link

Battery charge level 0.0% < threshold 31.0% #5305

Open JoseAngel-MAD opened 1 year ago

JoseAngel-MAD commented 1 year ago

Describe the bug I get an error message every time a task is executed and the screen is off:

battery charge level 0.0% < threshold 31.0%` Suspending computation - battery low

Steps to reproduce

  1. Set a minimum battery threshold.
  2. Execute a task.
  3. Turn off the screen.

Expected behaviour The app won't stop computation as long as the battery is not lower than the battery threshold.

System Information Samsung Galaxy A52s 5G - Snapdragon 778G - One UI 5.1 (Android 13) Boinc 7.22.2

Additional Context

I had been using version 7.18 of Boinc for several months and the bug was already present sometimes. I decided to update to the newest version, hoping that the issue would be resolved, but now it's even worse than before because the bug is constant. Now I get some strange messages on the app interface such as: 'The app will continue with the computation when the battery reaches 31% (now 56%)'

Here are the logs from the client and the GUI:

CLIENT LOG

5 jul 2023 9:35:13||(battery charge level 0.0% < threshold 31.0%

5 jul 2023 9:35:13||Suspending computation - battery low

5 jul 2023 9:35:13||Checking presence of 57 project files

5 jul 2023 9:35:13||Setting up GUI RPC socket

5 jul 2023 9:35:13|World Community Grid|URL http://www.worldcommunitygrid.org/; Computer ID 8714668; resource share 0

5 jul 2023 9:35:13|Rosetta@home|URL https://boinc.bakerlab.org/rosetta/; Computer ID 6257239; resource share 100

5 jul 2023 9:35:13|BOINC Central|URL https://boinc.berkeley.edu/central/; Computer ID 6283; resource share 100

5 jul 2023 9:35:13||Checking active tasks

5 jul 2023 9:35:13||Setting up project and slot directories

5 jul 2023 9:35:13||- (to change preferences, visit a project web site or select Preferences in the Manager)

5 jul 2023 9:35:13||- max disk usage: 62.66 GB

5 jul 2023 9:35:13||- Store up to an additional 0.50 days of work

5 jul 2023 9:35:13||- Store at least 0.10 days of work

5 jul 2023 9:35:13||- Suspend if no input in last 60.000000 minutes

5 jul 2023 9:35:13||- max memory usage: 5.24 GB

5 jul 2023 9:35:13||- suspend if non-BOINC CPU load exceeds 100%

5 jul 2023 9:35:13||- Use at most 100% of the CPU time

5 jul 2023 9:35:13||- max CPUs used: 2

5 jul 2023 9:35:13||- When computer is not in use

5 jul 2023 9:35:13||- max memory usage: 5.24 GB

5 jul 2023 9:35:13||- suspend if non-BOINC CPU load exceeds 100%

5 jul 2023 9:35:13||- Use at most 100% of the CPU time

5 jul 2023 9:35:13||- max CPUs used: 2

5 jul 2023 9:35:13||- don't use GPU

5 jul 2023 9:35:13||- don't compute

5 jul 2023 9:35:13||- 'In use' means mouse/keyboard input in last 3.0 minutes

5 jul 2023 9:35:13||- When computer is in use

5 jul 2023 9:35:13||Preferences:

5 jul 2023 9:35:13||Reading preferences override file

5 jul 2023 9:35:13||Config: report completed tasks immediately

5 jul 2023 9:35:13||Local time is UTC +2 hours

5 jul 2023 9:35:13||Disk: 106.31 GB total, 62.64 GB free

5 jul 2023 9:35:13||Memory: 5.24 GB physical, 6.00 GB virtual

5 jul 2023 9:35:13||OS: Android: 5.4.210-qgki-25904254-abA528BXXU4EWE4

5 jul 2023 9:35:13||Processor features: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp

5 jul 2023 9:35:13||Processor: 8 ARM [Impl 0x41 Arch 8 Variant 0x2 Part 0xd05 Rev 0]

5 jul 2023 9:35:13||Host name: Snapdragon 778G - Samsung Galaxy A52s 5G

5 jul 2023 9:35:12||No usable GPUs found

5 jul 2023 9:35:11||Data directory: /data/user/0/edu.berkeley.boinc/client

5 jul 2023 9:35:11||Running as a daemon

5 jul 2023 9:35:11||Libraries: libcurl/8.0.1-DEV OpenSSL/3.1.0 zlib/1.2.13

5 jul 2023 9:35:11||log flags: file_xfer, sched_ops, task

5 jul 2023 9:35:11||Starting BOINC client version 7.22.2 for aarch64-android-linux-gnu


GUI LOG

Mensajes de la GUI

07-05 09:35:34.874 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:34.873 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:34.873 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:34.869 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:34.868 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:33.903 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:33.903 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:33.902 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:33.872 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:33.868 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:32.875 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:32.875 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:32.874 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:32.868 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:32.867 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:31.873 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:31.873 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:31.873 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:31.868 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:31.867 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:30.872 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:30.872 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:30.872 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:30.868 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:30.866 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:29.871 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:29.871 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:29.871 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:29.867 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:29.865 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:28.870 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:28.870 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:28.870 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:28.866 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:28.865 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:27.872 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:27.872 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:27.871 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:27.868 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:27.865 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus() 07-05 09:35:26.878 V/BOINC_GUI(10261): [CLIENT] ClientNotification: notification needs update? false false false false false 07-05 09:35:26.878 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): computation enabled: true 07-05 09:35:26.873 V/BOINC_GUI(10261): [CLIENT] setClientStatus: #results: 2 #projects: 3 #transfers: 0 // computing: computingParseError: false computingStatus: 3 computingSuspendReason: 0 - network: networkParseError: false networkStatus: 2 networkSuspendReason: 0 07-05 09:35:26.864 V/BOINC_GUI(10261): [MONITOR] readClientStatus(): screen on, get complete status 07-05 09:35:26.863 V/BOINC_GUI(10261): [MONITOR] reportDeviceStatus()

AenBleidd commented 1 year ago

@JoseAngel-MAD, thank you for the report. I'll take a look at it when I have time. Please be aware that BOINC is supported by the team of volunteers, so it might take some time. In the meanwhile, please check that:

  1. BOINC is in the exceptions of Android Battery Saving list.
  2. BOINC is always on the foreground (especially when the screen is off).
JoseAngel-MAD commented 1 year ago

@AenBleidd Thank you for your time and help! I checked what you mention but I had no luck.

ro371 commented 12 months ago

It happened the same to me, just add an option to not take into account battery %

ljez commented 11 months ago

Happens to me as well on Samsung S20FE with Android 12 and One UI 4.1, even when the screen is constantly on (using Caffeine).

BTW, @JoseAngel-MAD, BOINC is supposed to stop computations when the screen is off with relatively new Android, so I take it you mean that the battery level check occurs and fails after the screen turns off and is then turned back on?

JoseAngel-MAD commented 11 months ago

I did not know that Boinc was supposed to stop computations when the screen is off with a relatively new Android. I must say that I don't understand that behavior, it does not make any sense to me. That feature should be optional. Anyway, the battery level check occurs and fails after the screen turns off and is then turned back on as you say. When the screen is off the computation gets suspended and, as soon as I turn the screen on, I get the message about the battery and I can't restart the computation.

ljez commented 11 months ago

I did not know that Boinc was supposed to stop computations when the screen is off with a relatively new Android. I must say that I don't understand that behavior, it does not make any sense to me. That feature should be optional.

It's the system's power saving "feature", not BOINC's fault. Perhaps I got it slightly wrong, but see what https://boinc.berkeley.edu/wiki/Installing_on_Android says about Android 9+: "Android kills BOINC if the display is turned off." Though my experience is that (if the phone is actually on battery, i.e., not plugged in), Android does not kill it, but rather stops the computations immediately.

JoseAngel-MAD commented 11 months ago

You may be right, I know nothing about Android policies. However, I am pretty sure that BOINC suspends computation when the screen is off because of the bug (computation is suspended because BOINC wrongly thinks that the battery is lower than the threshold)

hucker75 commented 11 months ago

Same is happening here, but it didn't used to. I think what changed was I set a lower level. It's ok with it set to only run above 90%, but if you use something lower like 20%, I get the silly message "computation will resume when above 20%, currently 100%", which stays there forever (I know there's a delay to stop it going on and off every few seconds - which I think would be better to have hysteresis like a room thermostat, stop computation when it drops below 80%, and start when it reaches 90%, because the way it works now, you have to wait for ages to see if a change you made is working).

hucker75 commented 11 months ago

Boinc (or Android) does not suspend when the screen is off. I've not seen that on Android 4, 7, 10, 11, or 12. Boinc can be told to suspend when it's on, but not off.

Make sure in the system settings (that's Android system settings, not within Boinc), under apps, then Boinc, then battery, you disable battery optimisation.

AenBleidd commented 11 months ago

Boinc (or Android) does not suspend when the screen is off. I've not seen that on Android 4, 7, 10, 11, or 12. Boinc can be told to suspend when it's on, but not off.

You might not mention it because it will be just silently aborted, but when next time you unblock your cell phone, BOINC will just restart.

And this behavior is very different on different cell phone manufacturers

hucker75 commented 11 months ago

I watch Boinc on all the phones and computers with Boinctasks on a Windows machine, so I can see if it's running even when the screen is off. Also the lack of heat from the corner of the phone is a sign it's stopped.

So setting it to 90% has allowed the weird % battery message to go away, but the message returns a short while (about a minute or so) after the screen is switched off. This is a phone which worked flawlessly for over a year, but when it became my second phone, I wiped it and only put Boinc on (to give it more RAM), but I can't work out what I've set up differently. For now I'm going to try leaving the screen on all the time. I guess I just waste a bit of power and hope the backlight doesn't wear out. That's if I can find an app to do so, stupid Android won't go over 30 minutes.

AenBleidd commented 11 months ago

This issue definitely requires more investigation from my side. Will come back when I have more information about it.

hucker75 commented 11 months ago

Could this be related to the recent change to prevent it stopping and starting repeatedly while the battery level hovers around the set value?

AenBleidd commented 11 months ago

Could this be related to the recent change to prevent it stopping and starting repeatedly while the battery level hovers around the set value?

No, I don't think so, but I need to verify to be sure in order to fix this issue properly

hucker75 commented 11 months ago

I've found the problem (on my phone at least). If Boinc uses too much RAM, Android closes it (some stupid way the OS works, it doesn't even inform the user it's done so). Boinc autoreopens, and the cycle continues. If I tell Boinc to use less RAM, the problem goes away. Not sure you can get round this by reprogramming Boinc, maybe there's a flag you can set to stop Android closing it?

Strangely this didn't used to happen to me, the phone just became slow. Must be a system setting which is different since reformatting.

AenBleidd commented 11 months ago

Not sure you can get round this by reprogramming Boinc, maybe there's a flag you can set to stop Android closing it?

None of the legal ways I'm aware about (that will not require root permissions and will not violate any existing Google Android rules).

But I'll check it out, thank you for the very valuable information.

hucker75 commented 11 months ago

As it seems to stop happening if there's plenty RAM, perhaps if there was a marker on the slider, or a text warning to discourage the user setting RAM usage too high? And telling the user what the symptoms would be were it set too high? Virtualbox has a similar thing when allocating RAM and CPU usage to the virtual machine.

Or monitor the free RAM on the phone, and reduce Boinc's RAM usage before it reaches the point Android protects itself.

AenBleidd commented 11 months ago

@hucker75,

before it reaches the point Android protects itself.

Not sure there is anywhere an information about such a point. Also, this might be very different for various manufacturers.

In general idea about the warning looks interesting, thank you for the suggestion

davidpanderson commented 11 months ago

When Android kills an app, does it tell it why?

AenBleidd commented 11 months ago

@davidpanderson,

When Android kills an app, does it tell it why?

It depends. Some versions (mostly several last versions) just warn users on the next device unblock that the application was consuming too much resources, and thus was stopped. Some versions just completely silent about this.

Potentially, we can catch such a cases, and on the app restart to show the user what happened, but it need to be investigated how to do that properly.

ljez commented 11 months ago

For now I'm going to try leaving the screen on all the time. I guess I just waste a bit of power and hope the backlight doesn't wear out. That's if I can find an app to do so, stupid Android won't go over 30 minutes.

An app called Caffeine can do that for you.

I've found the problem (on my phone at least). If Boinc uses too much RAM, Android closes it (some stupid way the OS works, it doesn't even inform the user it's done so). Boinc autoreopens, and the cycle continues. If I tell Boinc to use less RAM, the problem goes away. Not sure you can get round this by reprogramming Boinc, maybe there's a flag you can set to stop Android closing it?

Strangely this didn't used to happen to me, the phone just became slow. Must be a system setting which is different since reformatting.

To clarify, did reducing the amount of memory BOINC can use solve the problem completely for you? I.e., it does not require the display to be on?

Another strange thing I did notice is that if I just leave the phone with its display on, eventually it does restart the computations.

hucker75 commented 11 months ago

For me, the screen being off is irrelevant. Only the opposite can happen, Boinc can be set to stop when the screen is on (so it doesn't slow you using the phone).

Reducing memory works fine. I put it to 10%, and it ran one Rosetta task ok. Once I'd seen it running for 10 minutes, I upped it to 20%, 30%, and so on until it caused problems. When it does Rosetta which is memory hungry, it now runs less tasks. But if it gets small tasks from other projects, it can use all the cores.

This is on a Samsung A10 (8 cores, 2GB RAM, factory reset to clean out junk and only Boinc installed) with Android 11. I don't get the problem on my Motorola G31 (8 cores, 4GB RAM, Android 12 and loads of stuff installed).

I also have a VKWorld MixPlus (4 cores, 3GB RAM). None of these phones have ever cared if the screen is off. They all run 24/7, plugged into chargers. Perhaps there's a setting in Android somewhere to power down apps when the screen is off? I've never seen one, so if there is mine is on the default. Your default may be different on a different phone.

davidpanderson commented 11 months ago

What was the highest memory usage that didn't cause problems? Maybe we should make that the default limit.

ljez commented 11 months ago

What was the highest memory usage that didn't cause problems? Maybe we should make that the default limit.

I suspect there is no single answer, as this likely depends on the amount of memory the phone has (the allowed usage is specified as a percentage, not an absolute value), its Android version, and any apps and services that it is supposed to be running in the background all the time.

hucker75 commented 11 months ago

Indeed, I think the best way is to inform the user they may need to lower it. A simple note below the memory slider saying "if Boinc often restarts, your RAM is overloaded, lower this value"

dchmelik commented 7 months ago

I have same problem with Android BOINC updated a few days ago. I set it to compute when battery is 70% or more, but when it's 71% to 100% it usually says it's waiting for it to reach 70%.

dchmelik commented 5 months ago

It's also regardless if screen is on or off... still happening on Android BOINC v8.

JoseAngel-MAD commented 5 months ago

8.0.0 (Development version) solved the bug/problem, at least for me. Just completed two tasks perfectly on my Galaxy A52s 5G (Android 14). Thanks!

dchmelik commented 5 months ago

Sometimes tasks still run, but you'll probably find even though that's the case, this problem still happens intermittently--unlikely to be fixed for anyone.

myclevorname commented 3 months ago

8.0.0 did not solve the problem for me. The GUI itself reports the current battery level as 21%, and the event log reported it as 0%, compared to the threshold of 10%. After waiting a while, it started working fine. I think the battery level should be saved to the variable BEFORE checking it for the threshold. If it reports 0%, make it get the battery level again.