After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 627903 - Race condition in idle monitor
Race condition in idle monitor
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: gnome-session
git master
Other Linux
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-25 01:13 UTC by Christopher Halse Rogers
Modified: 2011-05-26 09:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set the negative transition threshold to be 1ms less than the positive transition threshold (602 bytes, patch)
2010-08-25 01:13 UTC, Christopher Halse Rogers
committed Details | Review

Description Christopher Halse Rogers 2010-08-25 01:13:09 UTC
Created attachment 168694 [details] [review]
Set the negative transition threshold to be 1ms less than the positive transition threshold

While investigating https://bugzilla.gnome.org/show_bug.cgi?id=625374 I've run across a corner case in the gnome-session idle monitor which also exposes the Xserver bug referenced in that gnome-screensaver bug.

In _xsync_alarm_set in gs-idle-monitor.c the positive and negative transition intervals are set to the same value.  However, the SYNC extension defines the positive transition as set when the counter goes from strictly below the threshold to greater than or equal to the threshold and similarly a negative transition is triggered when the counter goes form strictly greater than the threshold to less than or equal to the threshold.

Thus in the current set up there's a chance that the positive transition can trigger, marking the session as idle, and some user input occur on the same click so the IDLETIME count will hit the threshold but not go above so the negative transition will not trigger.  Thus the session will not be marked as active.

The negative transition threshold should be set to 1ms less than the positive transition to ensure that it always fires.
Comment 1 Tim Taiwanese Liim 2010-10-20 03:52:18 UTC
I have different opinion: neither gnome-screensaver nor gnome-session
is broken.  Please see
    https://bugzilla.redhat.com/show_bug.cgi?id=612620#c49
for argument.
Comment 2 Christopher Halse Rogers 2010-12-19 08:21:45 UTC
I (still) disagree - the only specification I've found for positive & negative transitions implies that the way gnome-session sets up its triggers is subject to a 1ms window from when the session gets marked as idle where input will not trigger the session being marked as active (and, furthermore, the session will not be marked as active until the idle trigger was reached again).

This is currently masked by the Xserver bug which makes it likely that input events after the threshold will be ignored.
Comment 3 Tim Taiwanese Liim 2010-12-26 21:18:33 UTC
> I (still) disagree ...
Me too.  But since you are the one who spent time working on
Xext/sync.c, let's stop here.  By now whatever works is fine with
me.

> the only specification I've found for positive & negative
> transitions ...
Could you share this spec?  Thanks.
Comment 4 Vincent Untz 2011-05-26 09:10:44 UTC
Thanks, I've read a bit more on that, and this is now pushed.