boinc icon indicating copy to clipboard operation
boinc copied to clipboard

"Suspend when non-BOINC CPU usage is above" setting fails with VirtualBox tasks

Open JonathanBush opened this issue 1 year ago • 7 comments

Describe the bug BOINC client detects VirtualBox Headless Frontend as non-BOINC CPU usage and pauses computation based on the "Suspend when non-BOINC CPU usage is above" setting.

Steps To Reproduce

  1. Attach a project that uses VirtualBox (e.g. LHC@home). VirtualBox must be installed. Project should be set to utilize all available cores.
  2. In Advanced View, open Computing Preferences. Enable the "Suspend when non-BOINC CPU usage is above" and enter 90 in the text field. Save the new computing preferences.
  3. Ensure that "Run based on preferences" is selected in the Activity menu.
  4. Observe CPU usage in Task Manager. Ensure that no other user processes have high CPU utilization.
  5. Wait for a VBox task to initialize and start heavy computation. If this bug is reproducible, you should see the task status switch to "Suspended - CPU is busy" and see "Suspending computation - CPU is busy" in the event log.

Expected behavior BOINC should continue running until non-BOINC CPU load exceeds the set threshold.

System Information

  • OS: Windows 10
  • BOINC Version: 8.0.2

Additional context I enabled this setting with a non-BOINC utilization percentage of 90% so that BOINC would pause when I run workloads that need full use of the CPU cache. Recently noticed this issue with LHC@home tasks. I also noticed that the VM keeps running in the background when BOINC is suspended.

JonathanBush avatar Oct 07 '24 19:10 JonathanBush

The BOINC client looks for a program called 'VBoxSVC.exe' (case sensitive) and, if any VM apps are running, counts its CPU time as due to BOINC.

To check this, can you please (while a BOINC VM app is running)

  • run Task Manager (ctrl-alt-del)
  • look for 'VirtualBox Interface' under Background Processes
  • check its CPU usage (should be high)
  • right-click on it and select Properties
  • verify that the program name is exactly 'VBoxSVC.exe'

Let me know if this is what you see. Also let me know what version of VBox you have installed (run VirtualBox Manager, click Help / About Virtualbox)

Thanks -- David

davidpanderson avatar Oct 07 '24 21:10 davidpanderson

I see 'VBoxSVC.exe' running, but its CPU utilization is 0%. The high CPU utilization is coming from one instance of 'VBoxHeadless.exe'. This was running VirtualBox 6.1.50. I also upgraded to VirtualBox 7.0.20 and observed the same behavior

JonathanBush avatar Oct 08 '24 00:10 JonathanBush

Aha. That's the culprit. We'll fix it ASAP. Thanks.

davidpanderson avatar Oct 08 '24 00:10 davidpanderson

VBoxSVC typically maintains the command queue sent by VBoxManage or the Vbox GUI. It's CPU usage is very low with small peaks when a VM is created, modified or shut down. Nonetheless those cycles should be counted for BOINC to avoid the total non-BOINC value goes right above the limit.

There may be more than one VBoxSVC instance on the same computer, 1 per user account running Vbox VMs. Example: VBoxSVC_1: related to a VM started by a service at boot time VBoxSVC_2: related to an account running BOINC

Here, VBoxSVC_1 doesn't count for BOINC.

computezrmle avatar Oct 08 '24 05:10 computezrmle

It looks like BOINC already has access to the PID of the VBoxHeadless.exe instance (PID shown in stderr.txt in the slots dir matches PID shown in Task Manger), so would it be possible to include only the CPU utilization from the known BOINC VM PID(s)? This would address @computezrmle's concern about non-BOINC VMs.

JonathanBush avatar Oct 08 '24 21:10 JonathanBush

It would be possible but I doubt that happens in practice (running BOINC/LHC and running another CPU-intensive VBox VM) so let's hold off.

BTW, looking at the vboxwrapper code (vbox_common.cpp) I see a function VBOX_BASE::launch_vboxvm() that's never called. Should we remove it?

davidpanderson avatar Oct 08 '24 23:10 davidpanderson

What people run inside separate VMs:

  • special services like mailservers
  • compile jobs
  • other DC clients like Folding at Home
  • even other BOINC clients

There are also people running multiple BOINC clients concurrently on the host and each of them may run VirtualBox VMs.

As for VBOX_BASE::launch_vboxvm(): Yes, it is never called. I'll prepare a PR to remove it.

computezrmle avatar Oct 09 '24 06:10 computezrmle