multiple caffeinated processes: suspends after first completes

Bug #1660605 reported by Andreas E.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Caffeine
Opinion
Undecided
Unassigned
caffeine (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

When running multiple processes with the `caffeinate` command, the computer suspends already after the first command completes, not after the last. As a result, when waking up the computer again, the other processes have not yet completed and need (again) more hours to finish.

Example workflow:
Gnome-terminal with four tabs

caffeine 2.8.3-3build1
Ubuntu 16.10 64bit

Revision history for this message
Andrej Shadura (andrew.sh) wrote :

Ack, makes sense that this happens — the first caffeination apparently enables the screensaver at its end, leading to a suspend. It should probably do something like a non-binary lock counter, so that only when the last process ends, caffeination ends.

Changed in caffeine (Ubuntu):
status: New → Confirmed
Revision history for this message
Reuben Thomas (rrt) wrote :

I'm the maintainer of caffeinate.

This shouldn't happen: caffeinate creates a separate window whose ID is passed to xdg-screensaver on each invocation.

I had a look at caffeinate, and I can't see any faults in its logic (of course, I welcome reports to the contrary!). In particular, I tested to make sure that it uses a different window ID when it is run in parallel in several instances.

As ever for bugs with caffeine and its friends, the way to find out where the bug is is to run the relevant xdg-screensaver commands manually:

$ xdg-screensaver suspend WINDOW_ID_1
$ xdg-screensaver suspend WINDOW_ID_2
$ xdg-screensaver resume WINDOW_ID_1

where WINDOW_ID_1 and WINDOW_ID_2 are the IDs of two different windows, obtained for example by running the following command twice:

$ xwininfo | grep "Window id" | cut -d " " -f 4

and in each case clicking on a different window. Whichever window it is, it must remain open for the duration of the experiment.

After running the 3 commands above, if the screensaver is now active again, that's a bug in xdg-screensaver.

Larry Kirch (larrykirch)
Changed in caffeine:
status: New → Incomplete
status: Incomplete → Opinion
Changed in caffeine (Ubuntu):
status: Confirmed → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.