caffeine 2.9.7 isn't working on Ubuntu 20.04

Bug #1700419 reported by Greg Sharek
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Caffeine
Fix Released
Undecided
Unassigned
caffeine (Debian)
New
Undecided
Unassigned
caffeine (Ubuntu)
Expired
Undecided
Unassigned
xdg-utils (Debian)
Fix Released
Unknown

Bug Description

Recently I noticed that caffeine 2.9.4 wasn't working any more on my Ubuntu 16.04 box. In https://bugs.launchpad.net/caffeine/+bug/1642380 they describe something similar.

First, looking at caffeine stdout, I see the following:

INFO:root:caffeine is inhibiting desktop idleness
Protocol error: bad 3 (Window); Sequence Number 13
 Opcode (20, 0) = GetProperty
 Bad resource 0 (0x0)
 at -e line 15.

Does that give you any info?

I also attempted to check xdg-screensaver as mentioned in the previous bug as follows:

Then, in a terminal, run

xdg-screensaver suspend `xwininfo | grep "Window id" | cut -d " " -f 4`

and click on the terminal window background. This should suspend the screensaver. Wait for the screensaver delay to check that the screen does not go off.

The screensaver was still enabled.

Tags: indeed
Greg Sharek (usnavi)
summary: - caffeine isn't working on Ubuntu 10.04
+ caffeine isn't working on Ubuntu 16.04
summary: - caffeine isn't working on Ubuntu 16.04
+ caffeine 2.9.4 isn't working on Ubuntu 16.04
description: updated
Revision history for this message
Reuben Thomas (rrt) wrote : Re: caffeine 2.9.4 isn't working on Ubuntu 16.04

Thanks for investigating this.

Unfortunately, I can't reproduce this on my fully updated GNOME Ubuntu 16.04 system; I'll check again next time I log out or reboot, as that may well make a difference.

The "Protocol error: bad 3 (Window)" suggests that an invalid window ID is being given. The only obvious way that can happen is if the full-screen window closes in the interval between caffeine getting its ID, and passing that ID to xdg-screensaver. However, since the error appears after the line

INFO:root:caffeine is inhibiting desktop idleness

which is only printed after xdg-screensaver has returned, it suggests that maybe the inhibition did work after all. Could you check whether the error appears at the same time as the INFO line? (It may just be a question of stderr vs stdout ordering.)

Secondly, can you confirm whether the xdg-screensaver command gives any error? If it doesn't, then it looks like there is at least a bug in xdg-screensaver.

Greg Sharek (usnavi)
tags: added: indeed
Changed in caffeine:
status: New → Incomplete
Changed in caffeine (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for caffeine (Ubuntu) because there has been no activity for 60 days.]

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

Just to confirm (sorry that I didn't do this earlier): Caffeine 2.9.4 continues to work for me on my fully-updated Ubuntu GNOME 16.04 systems.

Revision history for this message
Michael Thaler (matschi-klickme) wrote :

I'm getting the same protocol error on Debian

:~$ caffeine

 INFO:root:caffeine is inhibiting desktop idleness
 Protocol error: bad 3 (Window); Sequence Number 11
  Opcode (20, 0) = GetProperty
  Bad resource 0 (0x0)
  at -e line 15.
 INFO:root:caffeine is no longer inhibiting desktop idleness

:~$ uname -a
 Linux #hostname 4.15.0-3-amd64 #1 SMP Debian 4.15.17-1 (2018-04-19) x86_64 GNU/Linux

Desktop env: xfce4
 Packagelist: https://pastebin.com/mEtQkU6P

Screensaver: xscreensaver
 Packagelist

 :~$ apt search xscreensaver |grep installed

 xscreensaver/stable,testing,unstable,now 5.36-1 amd64 [installed]
 xscreensaver-data/stable,testing,unstable,now 5.36-1 amd64 [installed]

Revision history for this message
Reuben Thomas (rrt) wrote :

Closing as out of date.

Changed in caffeine:
status: Incomplete → Won't Fix
Revision history for this message
Reuben Thomas (rrt) wrote :

Reopening, as I have finally managed to reproduce this bug. It occurs for me when the title of a full screen window (the window for which Caffeine inhibits idleness) contains a non-ASCII character. This causes an error in the embedded Perl script in xdg-screensaver, in the subroutine screensaver_gnome_screensaver, where it tries to get the window name (the call to GetProperty). This in turn appears to be a bug in the Perl module X11::Protocol.

Changed in caffeine:
status: Won't Fix → Confirmed
Revision history for this message
Reuben Thomas (rrt) wrote :

Here is the upstream xdg-utils bug: https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/137

There is a patch for it, so xdg-utils should be patched in Ubuntu/Debian. I will look into this.

Revision history for this message
Reuben Thomas (rrt) wrote :

Unfortunately, the upstream bug I mentioned in #7 is for a related bug, not this one, and the patch for it has already been applied.

summary: - caffeine 2.9.4 isn't working on Ubuntu 16.04
+ caffeine 2.9.7 isn't working on Ubuntu 20.04
Revision history for this message
Reuben Thomas (rrt) wrote :

The patch for this bug: https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/98 does fix the problem, though I am not sure that the problem here is that the window has no title, rather that no title is reported by X11::Protocol. However, for our purposes that's good enough!

I shall ensure that this is raised on the xdg-utils Debian package. In the mean time, a workaround for users is to apply the patch from the above issue to xdg-screensaver, and place the patched version on their PATH (e.g. in ~/bin).

Revision history for this message
Reuben Thomas (rrt) wrote :

Ah embarrassingly, I find that this xdg-utils bug was filed by me, and the patch was also provided by me!

Changed in xdg-utils (Debian):
status: Unknown → Fix Released
Reuben Thomas (rrt)
Changed in caffeine:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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