BOINC / boinc

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

boinc_client does not notice (or does not care) that "computer is in use" #1187

Open romw opened 9 years ago

romw commented 9 years ago

Reported by Bluefin Tuna on 3 Apr 42799116 09:47 UTC On Linux (Fedora 17 KDE spin), boinc_client (7.0.28 x86_64-pc-linux-gnu) is running as user "boinc", a user not used for anything else.

Settings as per "Computing Preferences (apply to all BOINC projects in which you participate)" are for Processor Usage:

Suspend work while computer is on battery power?    yes
Matters only for portable computers                 yes
Suspend work while computer is in use?              yes
Suspend GPU work while computer is in use?          yes
'In use' means mouse/keyboard activity in last      5 minutes
Suspend work if no mouse/keyboard activity in last  --- minutes
Suspend work if CPU usage is above                  50%
Do work only between the hours of                   ---
Leave tasks in memory while suspended?              no
Switch between tasks every                          120 minutes
On multiprocessors, use at most                     --- processors
On multiprocessors, use at most                     100% of the processors
Use at most                                         75% of CPU time 

The machine has 2 non-threaded CPUs. As per lscpu:

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1

It also has a CUDA-capable graphics card, which is being used for BOINC projects.

Scenario:

Migrated-From: http://boinc.berkeley.edu/trac/ticket/1215

romw commented 9 years ago

Commented by ChristianB on 12 Nov 42799609 05:40 UTC Are you using a Fedora Package Manager installation or did you install BOINC after downloading from the official site? Packaged versions are not really supported by the official project because we don't know what the package maintainer changed and if this has some side-effects we don't know about.

To your question of a more verbose output you should look at the user wiki (http://boinc.berkeley.edu/wiki/Client_configuration) where you can find log_flags that are helpful in this case. The flags suspend_debug and task_debug may be helpful in your case.

Next question is about re-enabling computation after 45 minutes. If the user is still using the computer (mouse/keyboard activity) than this clearly is a bug. If the user is just watching a movie and not doing anything the System thinks that the computer is unused. This should be identified by the log messages. What shouldn't happen is that the computer is slowed down by the science apps. The regular BOINC client sets the process priority to lowest when starting any science application and therefore this shouldn't interfere with normal operations. Please refer to what I wrote about packaged versions of BOINC.

As GPU computing is allowed and a capable GPU is found you will always see three science processes started. One for each CPU and one for the GPU.

romw commented 9 years ago

Commented by Ageless on 13 Aug 42799721 01:44 UTC Also know that there was this fix in 7.0.29:

For logs on what may or may not be fixed already, see the BOINC 7 Change Log thread on the BOINC forums.

romw commented 9 years ago

Commented by Bluefin Tuna on 29 Oct 42800862 09:18 UTC Hi,

The boinc executable has been compiled from the 7.0.28 source directly.

I will add some log flags as described in the link, thank you.

In this case, I am using the computer for editing work while boinc is running. This makes the slowdown very noticeable (actually, things become unacceptably slow). I don't think I saw that behaviour before I enabled the GPU, so there may be some DMA or contention problem with the graphics driver/hardware (Btw, I am using the 'nvidia' driver instead of the Fedora 'nouveau' - unsure whether I should). Will test what happens with GPU disabled.

Will also try 7.0.31, this is going to take a bit...

romw commented 9 years ago

Commented by Bluefin Tuna on 15 Aug 42802452 16:43 UTC Update:

1) Looks like (USB) mouse mouvement is indeed not recognized. It's typing that triggers "computer in use" state.

2) The high-inertia effect is either due to the GPU or to einstein@home. Running "--no_gpus" (and thus only seti@home) triggers instant shutdown when "computer in use" is detected. If einstein@home is using the GPU, then shutdown is "rather slow" (will have to time) and for some reason response times of applications suffer a lot.

romw commented 9 years ago

Commented by Bluefin Tuna on 21 Sep 42808484 17:52 UTC Update:

'''Without GPU'''

'''With GPU'''

Germano0 commented 8 years ago

Hi, I am the Fedora's BOINC-client co-maintainer. User idle time detection based on /dev/input/* does not work, since many Linux distributions like Debian, Fedora, Ubuntu do not update the "access time" of /dev/input/* (see stat /dev/input/foo) Moreover:

There is a smarter way to do that: I have seen in client/hostinfo_unix.cpp a section that concerns Apple Mac OS, you could add another section concerning Linux distributions that use systemd and implement user idle time detection using logind through the GDBus API of Glib/GIO

# gdbus introspect --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 | grep -i idle
      readonly b IdleHint = false;
      readonly t IdleSinceHint = 0;
      readonly t IdleSinceHintMonotonic = 0;
      readonly s IdleAction = 'ignore';
      readonly t IdleActionUSec = 1800000000;

What do you think about?

This message has been sent also to boinc-devel mailing list

Thanks to @fweimer and @lmctv for their suggestions

Germano0 commented 8 years ago

For your info, I removed the not working implementation of idle detection, from Fedora's BOINC. This avoids SELinux alerts and setroubleshot process high CPU usage

ChristianBeer commented 8 years ago

I did a bit experimenting with the sd-bus API to determine the idle state. I have a small test program but it always reports the system as not idle. I also found that the IdleHint is only changed when the Desktop Manager (like Gnome and KDE) reports the system as idle. So this would not work for systems that don't have a Desktop Manager. I still think it's worth to investigate more so it at least works for systems with a DM. I'll keep trying.

Germano0 commented 7 years ago

I have seen changelog https://boinc.berkeley.edu/dev/forum_thread.php?id=10204&postid=67990 and I was wondering about the state of this bugreport. Unfortunately I still had not the opportunity to make some tests due https://boinc.berkeley.edu/dev/forum_thread.php?id=11446

Germano0 commented 7 years ago

I made a dff between hostinfo_unix.cpp of boinc 7.6.22 and 7.6.33:

$ diff boinc_7.6.22_hostinfo_unix.cpp boinc_7.6.33_hostinfo_unix.cpp 
43a44,53
> #if HAVE_XSS
> #include <X11/extensions/scrnsaver.h> //X-based idle detection
> // prevents naming collision between X.h define of Always and boinc's
> // lib/prefs.h definition in an enum.
> #undef Always
> #include <dirent.h> //for opening /tmp/.X11-unix/
>   // (There is a DirScanner class in BOINC, but it doesn't do what we want)
> #include "log_flags.h" // idle_detection_debug flag for verbose output
> #endif
> 
1314,1315c1324,1325
<     strncpy( p_model, "Alpha ", sizeof( p_model));
<     strncat( p_model, cpu_type_name, (sizeof( p_model)- strlen( p_model)- 1));
---
>     strlcpy(p_model, "Alpha ", sizeof(p_model));
>     strlcat(p_model, cpu_type_name, sizeof(p_model));
1949a1960,2146
> 
> #if HAVE_XSS
> 
> // Initializer for const vector<string> in xss_idle
> //
> const vector<string> X_display_values_initialize() {
> 
>   /* According to "man Xserver", each local Xserver will have a socket file
>    * at /tmp/.X11-unix/Xn, where "n" is the display number (0, 1, 2, etc).
>    * We will parse this directory for currently open Xservers and attempt
>    * to ultimately query them for their idle time. If we can't open this
>    * directory, or the display_values vector is otherwise empty, then a
>    * static list of guesses for open display servers is utilized instead
>    * (DISPLAY values ":{0..6}") that will attempt connections to the first
>    * seven open Xservers.
>    *
>    * If we were unable to open _any_ Xserver, then we will log this and
>    * xss_idle returns true, effectively leaving idle detection up to other
>    * methods.
>    */
>   static const string dir = "/tmp/.X11-unix/";
>   vector<string> display_values;
>   vector<string>::iterator it;
> 
>   DIR *dp;
>   struct dirent *dirp;
>   if((dp = opendir(dir.c_str())) == NULL) {
>     if ( log_flags.idle_detection_debug ) {
>       msg_printf(NULL, MSG_INFO, 
>         "[idle_detection] Error (%d) opening %s.", errno, dir.c_str());
>     }
>   }
> 
>   while ((dirp = readdir(dp)) != NULL) {
>     display_values.push_back(string(dirp->d_name));
>   }
>   closedir(dp);
> 
>   // Get rid of non-matching elements and format the matching ones.
>   for ( it = display_values.begin() ; it != display_values.end() ; ) {
>     if ( it->c_str()[0] != 'X' ) {
>       it = display_values.erase(it);
>     }
>     else {
>       replace(it->begin(), it->end(), 'X', ':');
>       it++;
>     }
> 
>   }
> 
>   // if the display_values vector is empty, assume something went wrong
>   // (couldn't open directory, no apparent Xn files). Test a static list of
>   // DISPLAY values instead that is likely to catch most common use cases.
>   // (I don't know of many environments where there will simultaneously be
>   // more than seven active, local Xservers. I'm sure they exist... somewhere.
>   // But seven was the magic number for me).
>   if ( display_values.size() == 0 ) {
>     if ( log_flags.idle_detection_debug ) {
>       msg_printf(NULL, MSG_INFO,
>         "[idle_detection] No DISPLAY values found in /tmp/.X11-unix/.");
>       msg_printf(NULL, MSG_INFO,
>         "[idle_detection] Using static DISPLAY list, :{0..6}.");
>     }
>     display_values.push_back(":0");
>     display_values.push_back(":1");
>     display_values.push_back(":2");
>     display_values.push_back(":3");
>     display_values.push_back(":4");
>     display_values.push_back(":5");
>     display_values.push_back(":6");
>     return display_values;
>   }
>   else {
>     return display_values;
>   }
> }
> 
> /* Ask the X server for user idle time (using XScreenSaver API)
>  * Return true if the idle time exceeds idle_threshold for all accessible
>  * Xservers. However, if even one Xserver reports busy/non-idle, then
>  * return false. This function assumes that the boinc user has been
>  * granted access to the Xservers a la "xhost +SI:localuser:boinc". If
>  * access isn't available for an Xserver, then that Xserver is skipped.
>  * One may drop a file in /etc/X11/Xsession.d/ that runs the xhost command
>  * for all Xservers on a machine when the Xservers start up.
>  */
> bool xss_idle(long idle_threshold) {
> 
>   const vector<string> display_values = X_display_values_initialize();
>   vector<string>::const_iterator it;
>   // If we can connect to at least one DISPLAY, this is set to false.
>   bool no_available_x_display = true;
> 
>   static XScreenSaverInfo* xssInfo = XScreenSaverAllocInfo();
>   // This shouldn't fail. XScreenSaverAllocInfo just returns a small
>   // struct (see "man 3 xss"). If we can't allocate this, then we've
>   // got bigger problems to worry about.
>   if ( xssInfo == NULL ) {
>     if ( log_flags.idle_detection_debug ) {
>       msg_printf(NULL, MSG_INFO,
>         "[idle_detection] XScreenSaverAllocInfo failed. Out of memory? Skipping XScreenSaver idle detection.");
>     }
>     return true;
>   }
> 
>   for (it = display_values.begin() ; it != display_values.end() ; it++) {
> 
>     Display* disp = NULL;
>     long idle_time = 0;
>     
>     disp = XOpenDisplay(it->c_str());
>     // XOpenDisplay may return NULL if there is no running X
>     // or DISPLAY points to wrong/invalid display
>     if (disp == NULL) {
>       if ( log_flags.idle_detection_debug ) {
>       msg_printf(NULL, MSG_INFO, 
>       "[idle_detection] DISPLAY '%s' not found or insufficient access.",
>       it->c_str());
>       }
>       continue;
>     }
> 
>     // Determine if the DISPLAY we have accessed has the XScreenSaver
>     // extension or not.
>     int event_base_return, error_base_return;
>     if (!XScreenSaverQueryExtension(
>       disp, &event_base_return, &error_base_return
>     )){
>       if ( log_flags.idle_detection_debug ) {
>       msg_printf(NULL, MSG_INFO,
>         "[idle_detection] XScreenSaver extension not available for DISPLAY '%s'.",
>         it->c_str());
>       }
>       XCloseDisplay(disp);
>       continue;
>     }
> 
>     // All checks passed. Get the idle information.
>     no_available_x_display = false;
>     XScreenSaverQueryInfo(disp, DefaultRootWindow(disp), xssInfo);
>     idle_time = xssInfo->idle;
> 
>     // Close the connection to the XServer
>     XCloseDisplay(disp);
> 
>     // convert from milliseconds to seconds
>     idle_time = idle_time / 1000;
> 
>     if ( log_flags.idle_detection_debug ) {
>       msg_printf(NULL, MSG_INFO, 
>         "[idle_detection] XSS idle detection succeeded on DISPLAY '%s'.", it->c_str());
>       msg_printf(NULL, MSG_INFO, 
>         "[idle_detection] idle threshold: %ld", idle_threshold);
>       msg_printf(NULL, MSG_INFO,
>         "[idle_detection] idle_time: %ld", idle_time);
>     }
> 
>     if ( idle_threshold < idle_time ) {
>       if ( log_flags.idle_detection_debug ) {
>         msg_printf(NULL, MSG_INFO,
>           "[idle_detection] DISPLAY '%s' is idle.", it->c_str());
>       }
>     } else {
>       if ( log_flags.idle_detection_debug ) {
>         msg_printf(NULL, MSG_INFO,
>           "[idle_detection] DISPLAY '%s' is active.", it->c_str());
>       }
>       return false;
>     }
> 
>   }
> 
>   /* We should only ever get here if all Xservers (that were queryable) were
>    * idle. If none of the Xservers were queryable, we should still end up here,
>    * and simply report true. In that case, the xss_idle function effectively
>    * provides no information on the idle state of the system, as no Xservers
>    * were accessible to interrogate.
>    */
>   if ( log_flags.idle_detection_debug && no_available_x_display ) {
>     msg_printf(NULL, MSG_INFO,
>       "[idle_detection] Could not connect to any DISPLAYs. XSS idle determination impossible.");
>   }
>   return true;
> 
> }
> #endif // HAVE_XSS
> 
1974a2172,2177
> #if HAVE_XSS
>     if (!xss_idle((long)(idle_time_to_run * 60))) {
>         return false;
>     }
> #endif // HAVE_XSS
> 
1993c2196
< #endif
---
> #endif // LINUX_LIKE_SYSTEM

So it looks like that now BOINC relies on X server to detect user idle time. I would like to ask you if you are interested in dropping the old code that runs stat on /dev/input and that now is used as "fallback" in case of failure of X detection, or you are interested in keeping it. Actually I just started testing BOINC 7.6.33 on Fedora 25

JuhaSointusalo commented 7 years ago

So it looks like that now BOINC relies on X server to detect user idle time.

Please notice that BOINC client needs permission to access X server or the XSS based idle detection won't work. See the discussion in #1453. Debian uses this file in etc/X11/Xsession.d/ .

interested in dropping the old code that runs stat on /dev/input

Maybe check with @romw what distro he used when he wrote the old code and if it ever worked. And check a variety of distros of different ages and make sure it doesn't work anywhere. And maybe check kernel build options that there isn't any switch that makes the old code work. And then throw the old code away.

LocutusOfBorg commented 7 years ago

Mmm what about headless servers? AFAIR this code was meant to work with them

ChristianBeer commented 7 years ago

We should definitely keep the fallback for systems that don't have X. What @Germano0 wants is a way to disable the access to /dev for certain Linux distributions that use SELinux and where this is triggering an alarm. Instead of removing the code we could make it possible to disable it at compile time and show a message at startup that idle detection does not work without an X server with this package.

JuhaSointusalo commented 7 years ago

@LocutusOfBorg @ChristianBeer

It's the all_input_idle() function we are talking about. It tries to detect activity by checking access time of event and mouse devices in /dev/input . @Germano0 said it doesn't work on Debian, Ubuntu and Fedora and I just tested that it doesn't work on Mint 17 = Ubuntu 14.04 kernel 3.13.0-105-generic and Rasbian Wheezy kernel 3.18.16+. The problem is that the access time is updated only when the device node is created, that is, when you plug in the device.

If it turns out that there is not a single distro where the code works then why bother keep it.

There is a similar test for pseudoterminal devices though you need to be using terminal for the test to work.

Germano0 commented 7 years ago

Instead of removing the code we could make it possible to disable it at compile time and show a message at startup that idle detection does not work without an X server with this package.

It would be great to have two different flags to disable:

Germano0 commented 7 years ago

On Fedora we will patch BOINC 7.6.33 to remove Xorg based idle detection too, because Fedora is using Wayland by default and Fedora servers do not run graphical server as @LocutusOfBorg said.

ChristianBeer commented 7 years ago

Summary of discussion above: Some Linux distributions don't want the BOINC Client to access anything in /dev or there is no XServer available at runtime. Thus the conclusion was to provide two build time flags to disable:

The default should remain to be both enabled.

Ageless93 commented 6 years ago

@lfield, can you check if this is still a problem or requirement?

Germano0 commented 6 years ago

@lfield, can you check if this is still a problem or requirement?

@Ageless93 what do you mean?

Ageless93 commented 6 years ago

Laurence Field (lfield) is the Linux BOINC Release Manager. I'm pointing out issues that he may want to have fixed or check that they are fixed already so these issues can be closed.

Germano0 commented 6 years ago

@Ageless93 As Fedora / EPEL (RHEL/CentOS) BOINC co-maintainer (together with @lfield ) I can say that the situation of BOINC 7.8.3 is:

lfield commented 6 years ago

Having thought about this, I think that we should define the 'in use' option to only be relevant when there is a window manager. Having said that, it looks like this option is still not working.

kgerickson commented 6 years ago

This is still a problem. Would something like this work as a solution?

https://www.freshports.org/x11/xidle/

Germano0 commented 6 years ago

@kgerickson no https://github.com/BOINC/boinc/issues/1187#issuecomment-339070513

RubenKelevra commented 6 years ago

That's (still) an issue!

I'm running:

Sometimes the keyboard/mouse activity is detected, and BOINC pauses, just to continue the minute after, or maybe 2-3 minutes later. It looks not completely broken, but not reliable detecting the activity.

It's not fixed for 3 years now? come on guys!

laggarcia commented 5 years ago

This is still an issue in Fedora 29 :(

BryanQuigley commented 5 years ago

Has anyone found a systemd/dbus way to do this, or should we just start doing desktop environments?

lfield commented 5 years ago

For me idle detection is a desktop environment feature. CPU load is the default metric otherwise.

Germano0 commented 5 years ago

Has anyone found a systemd/dbus way to do this

Among my other activities, I am slowly playing with GDbus API of Glib/GIO. I said "slowly" because the documentation is very "sterile", and not helpful at all. Luckly there are some softwares that uses them, so you can take examples (like darktable)

or should we just start doing desktop environments?

????

laggarcia commented 5 years ago

dbus-send --print-reply --dest=org.gnome.Mutter.IdleMonitor /org/gnome/Mutter/IdleMonitor/Core org.gnome.Mutter.IdleMonitor.GetIdletime

The above call should give you idle time on gnome-shell (GNOME3) environments on top of Wayland. Not a perfect solution, but probably better than what we have today at least for Fedora default installation.

laggarcia commented 5 years ago

Another very interesting way to detect idle time for any user logged into a Linux system is to use the same approach used by the w tool. It basically get stat for the current terminal file (graphical, text, or serial) and watch for the last access timestamp (stat.st_atime).

Germano0 commented 5 years ago

The following comment illustrates how I was trying to resolve this problem, and the conclusion I arrived to.

Unfortunately we cannot use systemd-logind to detect user idle time because it relies on desktop environments to pass this information, but none does it. So I was starting to implement it for for GNOME and KDE Plasma. For the former, there is a DBus solution, for the latter instead, KIdleTime API is needed.

I managed to implement a raw prototype of BOINC user idle time detection for GNOME, and it works if the client is runned as user process. It cannot work with BOINC client running as a service because it runs as unprivileged and confined user, instead GNOME exposes GetIdletime method on DBus user session that is not reachable for processes that are not running under the same user.

In my opinion a good solution can be the following new BOINC client prototype vectorial version of the image

BOINC client will continue running as confined service, but we implement some code to let it be on DBus system session. We implement a new very tiny process that automatically runs on user space (thanks to a user space systemd unit file in path /etc/systemd/user). Since it will run with user privileges, it can talk to things that are running as user level, like objects that are connected to DBus user session as GNOME Idle Monitor, or directly to KDE IdleTime API. Moreover the tiny process will talk to BOINC client by connecting also to DBus system session.

What do you think about this proposal? Is it worth implementing, or are we introducing too much complexity for the Linux client?

Bibliography [systemd-devel] interacting with logind to detect user idle time [GNOME discourse] IdleMonitor (DBus) and unprivileged user [KDE Plasma devel] Concerning KIdleTime API (was Proposal: passing user idle time to systemd-logind) Concerning systemd user services Tom Huges and grift on #fedora-devel Freenode IRC channel

BryanQuigley commented 5 years ago

Thanks for running these down! I actually just asked systemd about doing a more kidletime like implementation in https://github.com/systemd/systemd/issues/12668 (although I didn't know what I was asking for was like kidletime until reading the thread you started)

If we can't get it in systemd proper (or somewhere else universal) I think we do need another simple utility unfortunately. It definitely should be handled by something on the system and not BOINC, IMHO (no pull with project though). I'll review it more when I have time.

Germano0 commented 5 years ago

@BryanQuigley you may want to attach your systemd ticket URL together with a comment, to the systemd mailing list thread I created about user idle time

[systemd-devel] interacting with logind to detect user idle time

You will quickly get feedback about systemd developers

Fifis commented 4 years ago

Still does not work properly in Arch Linux on BOINC 7.14.2.

ghost commented 4 years ago

Still doesn't work properly on Slackware-current 2020-03-28 when run as a different (dedicated) user.

Perhaps some documentation on how to permit x11 connection or something like that would be nice to have easily accessible in the gui.

jigpu commented 4 years ago

BOINC client will continue running as confined service, but we implement some code to let it be on DBus system session. We implement a new very tiny process that automatically runs on user space (thanks to a user space systemd unit file in path /etc/systemd/user). Since it will run with user privileges, it can talk to things that are running as user level, like objects that are connected to DBus user session as GNOME Idle Monitor, or directly to KDE IdleTime API. Moreover the tiny process will talk to BOINC client by connecting also to DBus system session.

What do you think about this proposal? Is it worth implementing, or are we introducing too much complexity for the Linux client?

Looks reasonable, though I don't think there's any particular need to deal with the system dbus. BOINC already has its own RPC mechanism that could be extended to include an "idle" interface. Your client (which could be a small independent program, or even the BOINC GUI) would periodically forward idle information from the session dbus through RPC and then BOINC would decide if enough idle time has passed. There would probably need to be a little care put into handling multiple simultaneous sessions (e.g. I've switched away from my roomates session, so BOINC sees both near-zero idle times from my session client, and very high idle times for the other session's client), but simply using the minimum of recent reports should be fine.

WatchThatLastSteph commented 4 years ago

Still an issue on Linux 5.4, Manjaro, using KDE Plasma and BOINC 7.17.0 built from the AUR. The client always thinks the system is in use if any of the "in use" options are enabled.

LinAGKar commented 4 years ago

For me, on OpenSUSE Tumbleweed KDE, boinc always acts like the system is idle. It used to work, at least if I did xhost si:localuser:boinc, but it got broken a few years ago.

jigpu commented 4 years ago

Just noticed this commit that looks like it might fix this issue: https://github.com/BOINC/boinc/commit/8a1099f816652cffdd24d8d0c91b36e6ae7ef031

LinAGKar commented 4 years ago

Not my issue at least. The comment there says that problem started in 7.16.4, but I'm on 7.16.3.

BryanQuigley commented 4 years ago

There are multiple issues, but if running a modern version it might be X detection is blocked (found during #3549 testing). Try editing boinc service so PrivateTmp=false to re-enable real X detection.

WatchThatLastSteph commented 4 years ago

There are multiple issues, but if running a modern version it might be X detection is blocked (found during #3549 testing). Try editing boinc service so PrivateTmp=false to re-enable real X detection.

Unfortunately that did not work for me. Current behavior is as follows under these specs:

OS: Manjaro Linux x86_64 
Host: MS-7A38 2.0 
Kernel: 5.4.33-3-MANJARO 
Uptime: 1 day, 17 hours, 5 mins 
Packages: 2429 (pacman), 1 (flatpak) 
Shell: zsh 5.8 
Resolution: 1600x900, 1920x1080, 1920x1080 
DE: Plasma 
WM: KWin 
WM Theme: Breeze 
Theme: Breath2 [Plasma], Breath-Dark [GTK2/3] 
Icons: breath2 [Plasma], breath2 [GTK2/3] 
Terminal: konsole 
CPU: AMD Ryzen 5 1600 (12) @ 3.400GHz 
GPU: NVIDIA GeForce GTX 1060 6GB 
Memory: 13547MiB / 32137MiB 

If compute preferences are set to suspend while computer is in use, it constantly stays suspended, but if set to suspend only GPU while is in use or when CPU usage is about 25%, it will run as expected, just without the GPU component.

If I let it go idle under those settings (GPU/CPU > 25%), then GPU still remains suspended.

jigpu commented 4 years ago

There are multiple issues, but if running a modern version it might be X detection is blocked (found during #3549 testing). Try editing boinc service so PrivateTmp=false to re-enable real X detection.

Unfortunately that did not work for me.

Same here with Arch Linux / GNOME 3.36 / Xorg session. My system is set to suspend the GPU while the computer is in use.

I used the Arch Linux build system to try compiling 7.16.6 with commit 8a1099f patched in. It seems to have done the trick for me. The GPU now properly starts up after the defined amount of idle time has passed and immediately stops as soon as I wiggle the mouse.

LinAGKar commented 4 years ago

There are multiple issues, but if running a modern version it might be X detection is blocked (found during #3549 testing). Try editing boinc service so PrivateTmp=false to re-enable real X detection

That doesn't seem to be it either. I didn't have PrivateTmp there, and adding it didn't help.

It's acting really wonky. It did suspend work on the GPU now, but only after I'd been using the computer for like half a minute, and then it started work again a few minutes later.

I tried enabling idle_detection_debug, but nothing shows up in the log.

LinAGKar commented 4 years ago

It looks like someone has deliberately broken idle detection: https://build.opensuse.org/request/show/627693

debianmain1 commented 4 years ago

I am also having problems with GPUs not starting after selecting "suspend GPU computing when computer is in use" Using current Debian Sid & Boinc Manager 7.16.6 from Debian. Tried the "PrivateTmp=false" without success. Anyone have another idea?

BryanQuigley commented 3 years ago

I just ran into /run/systemd/[session/user/seat]. It does actually seem to indicate when a session is active or not in xfce. STATE=active -> STATE=online. Need to investigate further...

ghost commented 3 years ago

Does elogind have the same feature?

aaronpuchert commented 3 years ago

@Germano0's proposals seems to be proper architecture for this. Idle detection needs to happen outside the client in the user session, so we need a separate service for it.

BOINC client will continue running as confined service, but we implement some code to let it be on DBus system session. We implement a new very tiny process that automatically runs on user space (thanks to a user space systemd unit file in path /etc/systemd/user). Since it will run with user privileges, it can talk to things that are running as user level, like objects that are connected to DBus user session as GNOME Idle Monitor, or directly to KDE IdleTime API. Moreover the tiny process will talk to BOINC client by connecting also to DBus system session.

I don't think we need the user space daemon to listen on the DBus system session, it could just use the existing BOINC RPC to communicate with the client, e.g. run boinccmd --set_run_mode auto when the session is idle and boinccmd --set_run_mode never when the session is active.

So it would only need to be on the user DBus, or for a prototype perhaps just run loginctl show-session. It could even be a script.