GNOME Bugzilla – Bug 627903
Race condition in idle monitor
Last modified: 2011-05-26 09:10:50 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.
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.
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.
> 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.
Thanks, I've read a bit more on that, and this is now pushed.