GNU bug report logs - #26973
26.0.50; sleep-for behavior changes with global-auto-revert-mode enabled

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Wed, 17 May 2017 23:58:01 UTC

Severity: normal

Found in version 26.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26973 in the body.
You can then email your comments to 26973 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Wed, 17 May 2017 23:58:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Gutov <dgutov <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 17 May 2017 23:58:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; sleep-for behavior changes with global-auto-revert-mode
 enabled
Date: Thu, 18 May 2017 02:57:17 +0300
[Message part 1 (text/plain, inline)]
1. Copy stp-test.el and test.sh to the same directory.
2. Evaluate the .el file.
3. M-x global-auto-revert-mode.
4. M-x start-file-process-test.
5. See the message log. "sleeping done!" comes before "process done!".

Without step 3, "process done!" comes before "sleeping done!".

So it looks like, effectively, global-auto-revert-mode stops sleep-for
from calling process sentinels, at least.

I don't remember seeing anything like this in Emacs 25.

sit-for is not affected, BTW.

In GNU Emacs 26.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version 3.20.9)
 of 2017-05-14 built on zappa
Repository revision: e6f64df9c2b443d3385c2c25c29ccd5283d37e3f
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.10
[sfp-test.el (text/x-emacs-lisp, attachment)]
[test.sh (application/x-shellscript, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 20 May 2017 11:38:01 GMT) Full text and rfc822 format available.

Message #8 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 26973 <at> debbugs.gnu.org
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sat, 20 May 2017 14:36:49 +0300
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Thu, 18 May 2017 02:57:17 +0300
> 
> 1. Copy stp-test.el and test.sh to the same directory.
> 2. Evaluate the .el file.
> 3. M-x global-auto-revert-mode.
> 4. M-x start-file-process-test.
> 5. See the message log. "sleeping done!" comes before "process done!".
> 
> Without step 3, "process done!" comes before "sleeping done!".
> 
> So it looks like, effectively, global-auto-revert-mode stops sleep-for
> from calling process sentinels, at least.
> 
> I don't remember seeing anything like this in Emacs 25.

Does anything change if you set auto-revert-use-notify to a nil value?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 20 May 2017 12:47:02 GMT) Full text and rfc822 format available.

Message #11 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26973 <at> debbugs.gnu.org
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Sat, 20 May 2017 15:45:57 +0300
On 20.05.2017 14:36, Eli Zaretskii wrote:

> Does anything change if you set auto-revert-use-notify to a nil value?

Yes: that seems to fix the problem.

In anticipation of the next question, my value of file-notify--library 
is `inotify'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 20 May 2017 13:39:01 GMT) Full text and rfc822 format available.

Message #14 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>, Michael Albinus <michael.albinus <at> gmx.de>
Cc: 26973 <at> debbugs.gnu.org
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Sat, 20 May 2017 16:38:12 +0300
> Cc: 26973 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Sat, 20 May 2017 15:45:57 +0300
> 
> On 20.05.2017 14:36, Eli Zaretskii wrote:
> 
> > Does anything change if you set auto-revert-use-notify to a nil value?
> 
> Yes: that seems to fix the problem.
> 
> In anticipation of the next question, my value of file-notify--library 
> is `inotify'.

Right, that's what I thought.  I'm sure Michael (CC'ed) will look into
this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 21 May 2017 22:39:02 GMT) Full text and rfc822 format available.

Message #17 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>, Michael Albinus <michael.albinus <at> gmx.de>
Cc: 26973 <at> debbugs.gnu.org
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Mon, 22 May 2017 01:38:31 +0300
On 20.05.2017 16:38, Eli Zaretskii wrote:

>> In anticipation of the next question, my value of file-notify--library
>> is `inotify'.
> 
> Right, that's what I thought.  I'm sure Michael (CC'ed) will look into
> this.

Thanks, waiting for Michael.

BTW, accept-process-output also seems broken in similar scenarios.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Mon, 22 May 2017 04:08:02 GMT) Full text and rfc822 format available.

Message #20 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 26973 <at> debbugs.gnu.org, michael.albinus <at> gmx.de
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Mon, 22 May 2017 07:06:57 +0300
> Cc: 26973 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Mon, 22 May 2017 01:38:31 +0300
> 
> BTW, accept-process-output also seems broken in similar scenarios.

Of course: both accept-process-output and sleep-for call the same
low-level API.

I hope it isn't something related to threads...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Mon, 22 May 2017 07:53:02 GMT) Full text and rfc822 format available.

Message #23 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26973 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Mon, 22 May 2017 09:52:45 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> > Does anything change if you set auto-revert-use-notify to a nil value?
>> 
>> Yes: that seems to fix the problem.
>> 
>> In anticipation of the next question, my value of file-notify--library 
>> is `inotify'.
>
> Right, that's what I thought.  I'm sure Michael (CC'ed) will look into
> this.

Will do. But this might take time; sleep-for and accept-process-output
are terra incognita for me until now.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Mon, 22 May 2017 18:26:01 GMT) Full text and rfc822 format available.

Message #26 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 26973 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Mon, 22 May 2017 21:24:54 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: Dmitry Gutov <dgutov <at> yandex.ru>,  26973 <at> debbugs.gnu.org
> Date: Mon, 22 May 2017 09:52:45 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> > Does anything change if you set auto-revert-use-notify to a nil value?
> >> 
> >> Yes: that seems to fix the problem.
> >> 
> >> In anticipation of the next question, my value of file-notify--library 
> >> is `inotify'.
> >
> > Right, that's what I thought.  I'm sure Michael (CC'ed) will look into
> > this.
> 
> Will do. But this might take time; sleep-for and accept-process-output
> are terra incognita for me until now.

Let us know if you need any help.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Wed, 24 May 2017 00:59:02 GMT) Full text and rfc822 format available.

Message #29 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26973 <at> debbugs.gnu.org, michael.albinus <at> gmx.de
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Wed, 24 May 2017 03:58:01 +0300
On 5/22/17 7:06 AM, Eli Zaretskii wrote:

>> BTW, accept-process-output also seems broken in similar scenarios.
> 
> Of course: both accept-process-output and sleep-for call the same
> low-level API.

Does sit-for call the same API?

Because replacing (sleep-for 3) with (sit-for 3), or even (sit-for 3 t), 
avoids triggering the problem described here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Wed, 24 May 2017 18:34:01 GMT) Full text and rfc822 format available.

Message #32 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 26973 <at> debbugs.gnu.org, michael.albinus <at> gmx.de
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Wed, 24 May 2017 21:33:02 +0300
> Cc: michael.albinus <at> gmx.de, 26973 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Wed, 24 May 2017 03:58:01 +0300
> 
> On 5/22/17 7:06 AM, Eli Zaretskii wrote:
> 
> >> BTW, accept-process-output also seems broken in similar scenarios.
> > 
> > Of course: both accept-process-output and sleep-for call the same
> > low-level API.
> 
> Does sit-for call the same API?

It calls it in a slightly different manner.

> Because replacing (sleep-for 3) with (sit-for 3), or even (sit-for 3 t), 
> avoids triggering the problem described here.

Yes, I understand.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Thu, 25 May 2017 08:13:02 GMT) Full text and rfc822 format available.

Message #35 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26973 <at> debbugs.gnu.org, Andreas Politz <politza <at> hochschule-trier.de>,
 dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Thu, 25 May 2017 10:12:49 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Will do. But this might take time; sleep-for and accept-process-output
>> are terra incognita for me until now.
>
> Let us know if you need any help.

I've tried to bisect the master branch in order to see when the problem
started. Kind of impossible, due to the heavy changes in configuration
machinery of Emacs last weeks.

So I've followed the commits for inotify.c. With commit b2a83eed23 the
problem doesn't happen. It started to appear with next commit for
inotify.c, 158bb8555d.

I've Cc'ed Andreas, who's the author of that commit.

> Thanks.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Thu, 25 May 2017 09:46:01 GMT) Full text and rfc822 format available.

Message #38 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 26973 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Thu, 25 May 2017 11:45:22 +0200
[Message part 1 (text/plain, inline)]
I seems that the event flags used are to promiscuous and that this
prevents other processes from reading.  Removing ACCESS, OPEN and
CLOSE events appears to rectify the situation.

[Message part 2 (text/x-diff, inline)]
diff --git a/src/inotify.c b/src/inotify.c
index 290701349e..d43b959747 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -41,7 +41,21 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef IN_ONLYDIR
 # define IN_ONLYDIR 0
 #endif
-#define INOTIFY_DEFAULT_MASK (IN_ALL_EVENTS | IN_EXCL_UNLINK)
+#define INOTIFY_DEFAULT_MASK                                    \
+  (IN_ATTRIB |                                                  \
+   /* IN_ACCESS | */                                            \
+   /* IN_CLOSE_WRITE | */                                       \
+   /* IN_CLOSE_NOWRITE |  */                                    \
+   IN_CREATE |                                                  \
+   IN_DELETE |                                                  \
+   IN_DELETE_SELF |                                             \
+   IN_IGNORED |                                                 \
+   IN_MODIFY |                                                  \
+   IN_MOVE_SELF |                                               \
+   IN_MOVED_FROM |                                              \
+   IN_MOVED_TO |                                                \
+   /* IN_OPEN | */                                              \
+   IN_EXCL_UNLINK)
 
 /* File handle for inotify.  */
 static int inotifyfd = -1;
[Message part 3 (text/plain, inline)]
-ap

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Fri, 26 May 2017 14:47:01 GMT) Full text and rfc822 format available.

Message #41 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Fri, 26 May 2017 16:45:58 +0200
Andreas Politz <politza <at> hochschule-trier.de> writes:

Hi Andreas,

> I seems that the event flags used are to promiscuous and that this
> prevents other processes from reading.  Removing ACCESS, OPEN and
> CLOSE events appears to rectify the situation.

The patch ought to fix the bug, thanks. filenotify-tests.el pass also
all tests.

So I have committed the patch in your name. Dmitry, could you pls crosscheck?

> -ap

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Fri, 26 May 2017 18:07:02 GMT) Full text and rfc822 format available.

Message #44 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Fri, 26 May 2017 11:06:38 -0700
[Message part 1 (text/plain, inline)]
> the event flags used are to[o] promiscuous and that this
> prevents other processes from reading.  Removing ACCESS, OPEN and
> CLOSE events appears to rectify the situation.

This means that a later call to inotify-add-watch that lacks IN_OPEN 
will disable an already-existing watch that specifies IN_OPEN, right? 
That doesn't sound right.

I reviewed the inotify.c patches made since March and spotted what 
appear to be some problems related to this. What do you think of the 
attached patches? The first patch doesn't change behavior; it merely 
makes the later patches easier to write. The second patch restores 
onlydir (it appears to have been removed by mistake). The third patch 
uses IN_MASK_ADD instead of a promiscuous mask.

[0001-Simplify-computation-of-inotify-mask.patch (text/x-patch, attachment)]
[0002-Restore-inotify-onlydir-support.patch (text/x-patch, attachment)]
[0003-Depromiscuify-inotify-with-IN_MASK_ADD.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 27 May 2017 00:46:02 GMT) Full text and rfc822 format available.

Message #47 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Michael Albinus <michael.albinus <at> gmx.de>,
 Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973 <at> debbugs.gnu.org
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Sat, 27 May 2017 03:45:13 +0300
On 5/26/17 5:45 PM, Michael Albinus wrote:

> The patch ought to fix the bug, thanks. filenotify-tests.el pass also
> all tests.
> 
> So I have committed the patch in your name. Dmitry, could you pls crosscheck?

Looks fixed to me as well, thank you.

But I'm also looking forward to your response to Paul's concerns




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 27 May 2017 07:34:02 GMT) Full text and rfc822 format available.

Message #50 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 26973 <at> debbugs.gnu.org, Andreas Politz <politza <at> hochschule-trier.de>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sat, 27 May 2017 09:33:23 +0200
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> But I'm also looking forward to your response to Paul's concerns

I let this for Andreas.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 27 May 2017 16:37:02 GMT) Full text and rfc822 format available.

Message #53 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 26973 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sat, 27 May 2017 18:36:40 +0200
I think your patches are against an older revision.

Paul Eggert <eggert <at> cs.ucla.edu> writes:

> [...] a later call to inotify-add-watch that lacks IN_OPEN will
> disable an already-existing watch that specifies IN_OPEN, right? [...]

I don't think so. It means that no one can watch for open/close/access
events, because the flags from the caller are ignored when invoking the
library function (except for IN_DONT_FOLLOW, which in my understanding
does not change the underlying watch).

> [...] The second patch restores onlydir (it appears to have been
> removed by mistake). 

See above, I guess.

> The third patch uses IN_MASK_ADD instead of a promiscuous mask.

We could do that.

-ap




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sat, 27 May 2017 18:20:01 GMT) Full text and rfc822 format available.

Notification sent to Dmitry Gutov <dgutov <at> yandex.ru>:
bug acknowledged by developer. (Sat, 27 May 2017 18:20:02 GMT) Full text and rfc822 format available.

Message #58 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Sat, 27 May 2017 11:19:48 -0700
Andreas Politz wrote:

> I think your patches are against an older revision.

OK, I rebased the patches to master and installed them there (after adjusting to 
the comments below) so you shouldn't have to worry about version mismatch.

>> [...] a later call to inotify-add-watch that lacks IN_OPEN will
>> disable an already-existing watch that specifies IN_OPEN, right? [...]
> 
> I don't think so. It means that no one can watch for open/close/access
> events

Oh, right. I fixed the commit message accordingly.

>> [...] The second patch restores onlydir (it appears to have been
>> removed by mistake).
> 
> See above, I guess.

Yeah, I checked the GNU/Linux source code, and it is a flag that affects only 
the inotify_add_watch call itself, not the watch descriptor, so we don't need to 
worry about it colliding with other watches.

>> The third patch uses IN_MASK_ADD instead of a promiscuous mask.
> 
> We could do that.

Thanks, it's now done as part of the installed patches. I verified that the 
originally-reported bug is still fixed in master, and am marking the bug as done.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 27 May 2017 21:14:01 GMT) Full text and rfc822 format available.

Message #61 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sat, 27 May 2017 23:13:08 +0200
Paul Eggert <eggert <at> cs.ucla.edu> writes:

>>> [...] The second patch restores onlydir [...].

> Yeah, I checked the GNU/Linux source code, and it is a flag that
> affects only the inotify_add_watch call itself [...]

OK, I haven't been that thorough.  So, I suppose the call will fail for
a combination of onlydir with a non-directory filename.

>>> The third patch uses IN_MASK_ADD instead of a promiscuous mask.

But we still need to inhibit open/close/access events from being used by
any client in order to fix this bug.  (Unless someone finds a better way
by looking more closely into the problem relating to processes. Though
filenotify.el does not use them and so it may not be worth it.)

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 27 May 2017 21:30:02 GMT) Full text and rfc822 format available.

Message #64 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Sat, 27 May 2017 14:29:25 -0700
Andreas Politz wrote:
> I suppose the call will fail for
> a combination of onlydir with a non-directory filename.

Yes, that's right.

> we still need to inhibit open/close/access events from being used by
> any client in order to fix this bug.  (Unless someone finds a better way
> by looking more closely into the problem relating to processes. Though
> filenotify.el does not use them and so it may not be worth it.)

I didn't observe the problem with a little test case involving OPEN that I wrote 
myself. I agree it may not be worth looking into it. That being said, if you can 
easily explain the bug or supply a test case I can briefly look into fixing it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sat, 27 May 2017 21:57:01 GMT) Full text and rfc822 format available.

Message #67 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sat, 27 May 2017 23:56:06 +0200
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> I didn't observe the problem with a little test case involving OPEN
> that I wrote myself. I agree it may not be worth looking into it. That
> being said, if you can easily explain the bug or supply a test case I
> can briefly look into fixing it.

I didn't really look into it and just assumed that one of those flags
might trigger a circular transition preventing processes from reading.
For that I used the posted function, added a watch to the /tmp directory
and noticed that the problematic behavior occured, if any one of those
flags (open/close/access) were added.

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 28 May 2017 09:20:02 GMT) Full text and rfc822 format available.

Message #70 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sun, 28 May 2017 11:19:17 +0200
It just occured to me that the other back-ends may exhibit the same
behavior, when used outside of filenotify.el . For example w32notify
provides the flag

  'last-access-time'   -- report changes in last-access time

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 28 May 2017 15:14:02 GMT) Full text and rfc822 format available.

Message #73 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu, michael.albinus <at> gmx.de,
 dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sun, 28 May 2017 18:13:31 +0300
> From: Andreas Politz <politza <at> hochschule-trier.de>
> Date: Sun, 28 May 2017 11:19:17 +0200
> Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
> 	Dmitry Gutov <dgutov <at> yandex.ru>
> 
> 
> It just occured to me that the other back-ends may exhibit the same
> behavior, when used outside of filenotify.el . For example w32notify
> provides the flag
> 
>   'last-access-time'   -- report changes in last-access time

Sorry, I've lost track of the discussion -- could you please tell what
"same behavior" did you refer to, and what could be the problem with
the last-access-time flag provided by w32notify.c?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 28 May 2017 18:22:01 GMT) Full text and rfc822 format available.

Message #76 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50; sleep-for behavior changes with
 global-auto-revert-mode enabled
Date: Sun, 28 May 2017 11:21:33 -0700
Andreas Politz wrote:
> For that I used the posted function, added a watch to the /tmp directory
> and noticed that the problematic behavior occured, if any one of those
> flags (open/close/access) were added.

I couldn't reproduce the problem with the current master (commit 288b3ca). That 
is, I ran src/emacs -Q with this:

M-x load-file RET sfp-test.el RET
M-x global-auto-revert-mode RET
M-x start-file-process-test RET
(inotify-add-watch "/tmp" 'open (lambda (event) (message "event %s" event))) C-x C-e
M-x start-file-process-test RET

Both instances of start-file-process-test did "process done!" before "sleeping 
done!", which I gather is what is wanted.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 28 May 2017 21:20:01 GMT) Full text and rfc822 format available.

Message #79 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 26973-done <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sun, 28 May 2017 23:18:58 +0200
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> I couldn't reproduce the problem with the current master (commit
> 288b3ca). That is, I ran src/emacs -Q with this:

I can't either anymore.

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 04 Jun 2017 11:50:02 GMT) Full text and rfc822 format available.

Message #82 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973-done <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sun, 04 Jun 2017 13:49:27 +0200
Andreas Politz <politza <at> hochschule-trier.de> writes:

> It just occured to me that the other back-ends may exhibit the same
> behavior, when used outside of filenotify.el . For example w32notify
> provides the flag
>
>   'last-access-time'   -- report changes in last-access time

I've checked the kqueue and gfilenotify cases; the problem does not
occur. I cannot check w32notify.

> -ap

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 04 Jun 2017 14:01:01 GMT) Full text and rfc822 format available.

Message #85 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 26973-done <at> debbugs.gnu.org, eggert <at> cs.ucla.edu, politza <at> hochschule-trier.de,
 dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sun, 04 Jun 2017 17:00:14 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Date: Sun, 04 Jun 2017 13:49:27 +0200
> Cc: 26973-done <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>,
> 	Dmitry Gutov <dgutov <at> yandex.ru>
> 
> Andreas Politz <politza <at> hochschule-trier.de> writes:
> 
> > It just occured to me that the other back-ends may exhibit the same
> > behavior, when used outside of filenotify.el . For example w32notify
> > provides the flag
> >
> >   'last-access-time'   -- report changes in last-access time
> 
> I've checked the kqueue and gfilenotify cases; the problem does not
> occur. I cannot check w32notify.

Like I said: I've lost track of this discussion.  So could someone
please tell what could be "the problem", and in what situations it
might happen?  Then I could try test that with w32notify.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 04 Jun 2017 15:31:02 GMT) Full text and rfc822 format available.

Message #88 received at 26973-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26973-done <at> debbugs.gnu.org, eggert <at> cs.ucla.edu,
 Michael Albinus <michael.albinus <at> gmx.de>, dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sun, 04 Jun 2017 17:30:15 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Like I said: I've lost track of this discussion.  [...]

Activating global-auto-revert-mode seems to lead to starvation of the
collection of output from running processes in an inotify build.
Inhibiting the generation of open, close and access file-events seems to
have fixed this problem.

This lead to the hypotheses that, in case the above types of events are
reported, reading file-events while idling may by itself lead to the
generation of more file-events and thus making this process stuck in a
cycle.

Autorevert resp. filenotify.el does not include these events in its
event-mask passed to the various back-ends, such that this problem could
not be perceived, unless the back-ends are used directly.  (Except for
inotify, were a constant, promiscuous mask was previously used in order
to work around a different problem.)

So, if the above is true, other back-ends could exhibit the same
behavior, if they were to be instructed to generate open/close/access
events.  Again, since these events are not used by filenotify.el, it
would only show, if the back-end is invoked directly,
e.g. w32notify-add-watch with last-access-time.

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26973; Package emacs. (Sun, 04 Jun 2017 16:22:02 GMT) Full text and rfc822 format available.

Message #91 received at 26973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 26973 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu, michael.albinus <at> gmx.de,
 dgutov <at> yandex.ru
Subject: Re: bug#26973: 26.0.50;
 sleep-for behavior changes with global-auto-revert-mode enabled
Date: Sun, 04 Jun 2017 19:20:37 +0300
> From: Andreas Politz <politza <at> hochschule-trier.de>
> Cc: Michael Albinus <michael.albinus <at> gmx.de>,  26973-done <at> debbugs.gnu.org,  eggert <at> cs.ucla.edu,  dgutov <at> yandex.ru
> Date: Sun, 04 Jun 2017 17:30:15 +0200
> 
> Activating global-auto-revert-mode seems to lead to starvation of the
> collection of output from running processes in an inotify build.
> Inhibiting the generation of open, close and access file-events seems to
> have fixed this problem.

I thought this was inotify-specific, because of the flags used in that
back-end, is that correct?  w32notify uses only the flags specified by
the caller, it doesn't add any flags of its own.

> This lead to the hypotheses that, in case the above types of events are
> reported, reading file-events while idling may by itself lead to the
> generation of more file-events and thus making this process stuck in a
> cycle.

I'm not sure I understand how this could happen.  How can reading
events generate those same events?  Also, is this still related to
invoking sub-processes, or unrelated?

> So, if the above is true, other back-ends could exhibit the same
> behavior, if they were to be instructed to generate open/close/access
> events.  Again, since these events are not used by filenotify.el, it
> would only show, if the back-end is invoked directly,
> e.g. w32notify-add-watch with last-access-time.

So you are saying that if I install a watch for last-access-time
changes, and then change the last-access time of a watched file, I
could have more than one event read by Emacs?  If so, that's not what
I see: I see exactly one event for each change of the last-access
time.

Or should I try something else?  I can easily post the code and the
procedure I used, if that would help clarify the issue.

Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 03 Jul 2017 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.