unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
@ 2018-10-29 16:01 Justin Van Winkle
  2018-10-29 20:27 ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-29 16:01 UTC (permalink / raw)
  To: 33194

[-- Attachment #1: Type: text/plain, Size: 5119 bytes --]

From: Justin Van Winkle
<jvanwink@ct.i-did-not-set--mail-host-address--so-tickle-me>
To: bug-gnu-emacs@gnu.org
Subject: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a
file is being written to in the home directory
--text follows this line--

I enable global-auto-revert-mode.  I noticed that when I was scp'ing a
large file to my home directory, every emacs process on my machine was
trying to use 100% cpu.  When I stopped the file transfer, emacs would
go back to idle cpu usage.  I ran the emacs profiler and narrowed it
down to revert-buffer.  Auto revert was apparently listening for changes
in my home directory, even for things like file creation or file
modified for files emacs did not have open.

I am running emacs from the MASTER branch from the github mirror.

Doing this little experiment again with the emacs25 build that is
distributed with Ubuntu, no extra cpu usage was seen, so the bug is
either specific to emacs>26 or something about my build (which should
have been basically generic: autogen.sh; ./configure; make -j8   or
something to that effect).


In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-10-14 built on bt
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.1 LTS

Recent messages:
Loading autorevert...done
Loading paren...done
Eshell virtualenv support initialized.
For information about GNU Emacs and the GNU system, type C-h C-a.
[2018-10-29 11:56:06] ‘*scratch*’ [1 259200]
[2018-10-29 11:56:06] ‘ *Minibuf-0*’ [1 259200]
[2018-10-29 11:56:06] ‘*Messages*’ [0 259200]
[2018-10-29 11:56:06] ‘ *code-conversion-work*’ [0 259200]
[2018-10-29 11:56:06] ‘ *Echo Area 0*’ [0 259200]
[2018-10-29 11:56:06] ‘ *Echo Area 1*’ [0 259200]

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  global-flycheck-mode: t
  flycheck-mode: t
  show-paren-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec epa epg gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils elec-pair justin-theme pcomplete esh-var esh-io esh-cmd
esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode
esh-util clang-format xml flycheck derived cl-extra json map find-func
help-mode rx subr-x pcase jka-compr compile let-alist virtualenvwrapper
advice gud easy-mmode comint ansi-color ring s dash cl diary-lib
diary-loaddefs cal-menu calendar cal-loaddefs midnight edmacro kmacro
paren autorevert filenotify autoinsert cus-start cus-load finder-inf
info package easymenu epg-config url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars
seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 228652 15199)
 (symbols 48 29258 1)
 (miscs 40 61 108)
 (strings 32 53756 2633)
 (string-bytes 1 1775330)
 (vectors 16 21499)
 (vector-slots 8 577491 8994)
 (floats 8 65 52)
 (intervals 56 244 59)
 (buffers 992 11))

[-- Attachment #2: Type: text/html, Size: 6443 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-29 16:01 bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory Justin Van Winkle
@ 2018-10-29 20:27 ` Michael Albinus
  2018-10-29 21:13   ` Justin Van Winkle
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-10-29 20:27 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194

Justin Van Winkle <justin.vanwinkle@gmail.com> writes:

Hi Justin,

> I enable global-auto-revert-mode.  I noticed that when I was scp'ing a
> large file to my home directory, every emacs process on my machine was
> trying to use 100% cpu.  When I stopped the file transfer, emacs would
> go back to idle cpu usage.  I ran the emacs profiler and narrowed it
> down to revert-buffer.  Auto revert was apparently listening for
> changes in my home directory, even for things like file creation or
> file modified for files emacs did not have open.

How did you "scp'ing a large file"? Inside Emacs, using Tramp, or
outside Emacs?

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-29 20:27 ` Michael Albinus
@ 2018-10-29 21:13   ` Justin Van Winkle
  2018-10-29 21:14     ` Justin Van Winkle
  2018-10-30  6:21     ` Eli Zaretskii
  0 siblings, 2 replies; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-29 21:13 UTC (permalink / raw)
  To: michael.albinus; +Cc: 33194

[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]

Hi Michael,

It was outside of emacs.  SCP would trigger the cpu usage in emacs, rsync
would not (oddly).  Both "cat /dev/zero > somefile"  and "dd if=/dev/zero
of=somefile" would trigger it if somefile was in my $HOME directory, but
none of these would trigger it if I did it in, for example, $HOME/Downloads/

I am pretty sure I can reproduce this at will if you need.

- Justin

On Mon, Oct 29, 2018 at 4:27 PM Michael Albinus <michael.albinus@gmx.de>
wrote:

> Justin Van Winkle <justin.vanwinkle@gmail.com> writes:
>
> Hi Justin,
>
> > I enable global-auto-revert-mode.  I noticed that when I was scp'ing a
> > large file to my home directory, every emacs process on my machine was
> > trying to use 100% cpu.  When I stopped the file transfer, emacs would
> > go back to idle cpu usage.  I ran the emacs profiler and narrowed it
> > down to revert-buffer.  Auto revert was apparently listening for
> > changes in my home directory, even for things like file creation or
> > file modified for files emacs did not have open.
>
> How did you "scp'ing a large file"? Inside Emacs, using Tramp, or
> outside Emacs?
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 1650 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-29 21:13   ` Justin Van Winkle
@ 2018-10-29 21:14     ` Justin Van Winkle
  2018-10-30  6:21     ` Eli Zaretskii
  1 sibling, 0 replies; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-29 21:14 UTC (permalink / raw)
  To: michael.albinus; +Cc: 33194

[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]

Disabling global-revert-buffer-mode also led to emacs not using cpu.

On Mon, Oct 29, 2018 at 5:13 PM Justin Van Winkle <
justin.vanwinkle@gmail.com> wrote:

> Hi Michael,
>
> It was outside of emacs.  SCP would trigger the cpu usage in emacs, rsync
> would not (oddly).  Both "cat /dev/zero > somefile"  and "dd if=/dev/zero
> of=somefile" would trigger it if somefile was in my $HOME directory, but
> none of these would trigger it if I did it in, for example, $HOME/Downloads/
>
> I am pretty sure I can reproduce this at will if you need.
>
> - Justin
>
> On Mon, Oct 29, 2018 at 4:27 PM Michael Albinus <michael.albinus@gmx.de>
> wrote:
>
>> Justin Van Winkle <justin.vanwinkle@gmail.com> writes:
>>
>> Hi Justin,
>>
>> > I enable global-auto-revert-mode.  I noticed that when I was scp'ing a
>> > large file to my home directory, every emacs process on my machine was
>> > trying to use 100% cpu.  When I stopped the file transfer, emacs would
>> > go back to idle cpu usage.  I ran the emacs profiler and narrowed it
>> > down to revert-buffer.  Auto revert was apparently listening for
>> > changes in my home directory, even for things like file creation or
>> > file modified for files emacs did not have open.
>>
>> How did you "scp'ing a large file"? Inside Emacs, using Tramp, or
>> outside Emacs?
>>
>> Best regards, Michael.
>>
>

[-- Attachment #2: Type: text/html, Size: 2071 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-29 21:13   ` Justin Van Winkle
  2018-10-29 21:14     ` Justin Van Winkle
@ 2018-10-30  6:21     ` Eli Zaretskii
  2018-10-30  8:39       ` Michael Albinus
  2018-10-30 16:18       ` Justin Van Winkle
  1 sibling, 2 replies; 24+ messages in thread
From: Eli Zaretskii @ 2018-10-30  6:21 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: michael.albinus, 33194

> From: Justin Van Winkle <justin.vanwinkle@gmail.com>
> Date: Mon, 29 Oct 2018 17:13:22 -0400
> Cc: 33194@debbugs.gnu.org
> 
> It was outside of emacs.  SCP would trigger the cpu usage in emacs, rsync would not (oddly).  Both "cat
> /dev/zero > somefile"  and "dd if=/dev/zero of=somefile" would trigger it if somefile was in my $HOME
> directory, but none of these would trigger it if I did it in, for example, $HOME/Downloads/

Isn't this expected?  Auto-revert watches the directory of the file,
so if a lot of changes happen in that directory, Emacs will get a lot
of file-change notifications, and will need to process them.

If you don't like this, customize auto-revert-use-notify to not use
notifications.  Or maybe there's some system-wide customization of
inotify that determine the max frequency of inotify notifications when
the changes are to the same file.  (I don't know enough about inotify
to say anything more specific, sorry.)





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30  6:21     ` Eli Zaretskii
@ 2018-10-30  8:39       ` Michael Albinus
  2018-10-30 10:41         ` Eli Zaretskii
  2018-10-30 16:18       ` Justin Van Winkle
  1 sibling, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-10-30  8:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Justin Van Winkle, 33194

Eli Zaretskii <eliz@gnu.org> writes:

>> It was outside of emacs.  SCP would trigger the cpu usage in emacs,
>> rsync would not (oddly).  Both "cat
>> /dev/zero > somefile" and "dd if=/dev/zero of=somefile" would
>> trigger it if somefile was in my $HOME
>> directory, but none of these would trigger it if I did it in, for
>> example, $HOME/Downloads/
>
> Isn't this expected?  Auto-revert watches the directory of the file,
> so if a lot of changes happen in that directory, Emacs will get a lot
> of file-change notifications, and will need to process them.

Yes.

> If you don't like this, customize auto-revert-use-notify to not use
> notifications.  Or maybe there's some system-wide customization of
> inotify that determine the max frequency of inotify notifications when
> the changes are to the same file.  (I don't know enough about inotify
> to say anything more specific, sorry.)

From inotify(7):

       If successive output  inotify  events  produced  on  the  inotify  file
       descriptor  are  identical (same wd, mask, cookie, and name), then they
       are coalesced into a single event if the older event has not  yet  been
       read (but see BUGS).  This reduces the amount of kernel memory required
       for the event queue, but also means that an application can't use  ino‐
       tify to reliably count file events.

Maybe we will get the burst of events due to scp; a simple cp might
profit from the described behaviour.

One defense action which comes to mind is to manage the incoming
events. If there is a burst of `change' events in a short time, they
could be cumulated to one event, as inotify does. Implemented in
`file-notify-handle-event', this would applicable to all file
notification backends, and not only to inotify.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30  8:39       ` Michael Albinus
@ 2018-10-30 10:41         ` Eli Zaretskii
  2018-10-30 10:44           ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2018-10-30 10:41 UTC (permalink / raw)
  To: Michael Albinus; +Cc: justin.vanwinkle, 33194

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: Justin Van Winkle <justin.vanwinkle@gmail.com>,  33194@debbugs.gnu.org
> Date: Tue, 30 Oct 2018 09:39:50 +0100
> 
> One defense action which comes to mind is to manage the incoming
> events. If there is a burst of `change' events in a short time, they
> could be cumulated to one event, as inotify does. Implemented in
> `file-notify-handle-event', this would applicable to all file
> notification backends, and not only to inotify.

But won't that by itself require CPU for processing?





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 10:41         ` Eli Zaretskii
@ 2018-10-30 10:44           ` Michael Albinus
  2018-10-30 12:28             ` Eli Zaretskii
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-10-30 10:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: justin.vanwinkle, 33194

Eli Zaretskii <eliz@gnu.org> writes:

>> One defense action which comes to mind is to manage the incoming
>> events. If there is a burst of `change' events in a short time, they
>> could be cumulated to one event, as inotify does. Implemented in
>> `file-notify-handle-event', this would applicable to all file
>> notification backends, and not only to inotify.
>
> But won't that by itself require CPU for processing?

Yes, but is doesn't call `revert-buffer' for every single `change'
event.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 10:44           ` Michael Albinus
@ 2018-10-30 12:28             ` Eli Zaretskii
  2018-10-30 13:12               ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2018-10-30 12:28 UTC (permalink / raw)
  To: Michael Albinus; +Cc: justin.vanwinkle, 33194

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: justin.vanwinkle@gmail.com,  33194@debbugs.gnu.org
> Date: Tue, 30 Oct 2018 11:44:19 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> One defense action which comes to mind is to manage the incoming
> >> events. If there is a burst of `change' events in a short time, they
> >> could be cumulated to one event, as inotify does. Implemented in
> >> `file-notify-handle-event', this would applicable to all file
> >> notification backends, and not only to inotify.
> >
> > But won't that by itself require CPU for processing?
> 
> Yes, but is doesn't call `revert-buffer' for every single `change'
> event.

I believe you are saying that most of the CPU cycles are spent in the
actual reverting.  That might be so, but it isn't 100% sure, and I
think we need some data to back that up.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 12:28             ` Eli Zaretskii
@ 2018-10-30 13:12               ` Michael Albinus
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Albinus @ 2018-10-30 13:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: justin.vanwinkle, 33194

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

>> Yes, but is doesn't call `revert-buffer' for every single `change'
>> event.
>
> I believe you are saying that most of the CPU cycles are spent in the
> actual reverting.

Yes.

> That might be so, but it isn't 100% sure, and I think we need some
> data to back that up.

Of course, that's the plan. This week, and likely next week as well,
I'll be short in time. But it's on my todo.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30  6:21     ` Eli Zaretskii
  2018-10-30  8:39       ` Michael Albinus
@ 2018-10-30 16:18       ` Justin Van Winkle
  2018-10-30 16:58         ` Michael Albinus
  2018-10-30 17:32         ` Eli Zaretskii
  1 sibling, 2 replies; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-30 16:18 UTC (permalink / raw)
  To: eliz; +Cc: michael.albinus, 33194

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

To clarify, I was not writing to a file that was open in emacs.  In fact,
emacs would use 100% cpu even with no files opened, so long as
global-auto-revert-mode was activated.

On Tue, Oct 30, 2018 at 2:22 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Justin Van Winkle <justin.vanwinkle@gmail.com>
> > Date: Mon, 29 Oct 2018 17:13:22 -0400
> > Cc: 33194@debbugs.gnu.org
> >
> > It was outside of emacs.  SCP would trigger the cpu usage in emacs,
> rsync would not (oddly).  Both "cat
> > /dev/zero > somefile"  and "dd if=/dev/zero of=somefile" would trigger
> it if somefile was in my $HOME
> > directory, but none of these would trigger it if I did it in, for
> example, $HOME/Downloads/
>
> Isn't this expected?  Auto-revert watches the directory of the file,
> so if a lot of changes happen in that directory, Emacs will get a lot
> of file-change notifications, and will need to process them.
>
> If you don't like this, customize auto-revert-use-notify to not use
> notifications.  Or maybe there's some system-wide customization of
> inotify that determine the max frequency of inotify notifications when
> the changes are to the same file.  (I don't know enough about inotify
> to say anything more specific, sorry.)
>

[-- Attachment #2: Type: text/html, Size: 1708 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 16:18       ` Justin Van Winkle
@ 2018-10-30 16:58         ` Michael Albinus
  2018-10-30 17:02           ` Justin Van Winkle
  2018-10-30 17:32         ` Eli Zaretskii
  1 sibling, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-10-30 16:58 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194

Justin Van Winkle <justin.vanwinkle@gmail.com> writes:

Hi Justin,

> To clarify, I was not writing to a file that was open in emacs.  In
> fact, emacs would use 100% cpu even with no files opened, so long as
> global-auto-revert-mode was activated.

File notifications work on directory level.

Hmm, my suspicion that Emacs was reverting buffers seems to be
wrong. First, I will try to reproduce your problem, before proposing changes.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 16:58         ` Michael Albinus
@ 2018-10-30 17:02           ` Justin Van Winkle
  2018-10-30 17:08             ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-30 17:02 UTC (permalink / raw)
  To: michael.albinus; +Cc: 33194

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]

I suspect it had subscribed to changes to the $HOME directory for some
reason.


On Tue, Oct 30, 2018 at 12:58 PM Michael Albinus <michael.albinus@gmx.de>
wrote:

> Justin Van Winkle <justin.vanwinkle@gmail.com> writes:
>
> Hi Justin,
>
> > To clarify, I was not writing to a file that was open in emacs.  In
> > fact, emacs would use 100% cpu even with no files opened, so long as
> > global-auto-revert-mode was activated.
>
> File notifications work on directory level.
>
> Hmm, my suspicion that Emacs was reverting buffers seems to be
> wrong. First, I will try to reproduce your problem, before proposing
> changes.
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 1032 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 17:02           ` Justin Van Winkle
@ 2018-10-30 17:08             ` Michael Albinus
  2018-10-30 17:09               ` Justin Van Winkle
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-10-30 17:08 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194

Justin Van Winkle <justin.vanwinkle@gmail.com> writes:

Hi Justin,

> I suspect it had subscribed to changes to the $HOME directory for some
> reason.

Could you pls revert this? I would like to know whether Emacs is still
busy then with global-auto-revert-mode.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 17:08             ` Michael Albinus
@ 2018-10-30 17:09               ` Justin Van Winkle
  0 siblings, 0 replies; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-30 17:09 UTC (permalink / raw)
  To: michael.albinus; +Cc: 33194

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

I don't understand the request?

On Tue, Oct 30, 2018 at 1:08 PM Michael Albinus <michael.albinus@gmx.de>
wrote:

> Justin Van Winkle <justin.vanwinkle@gmail.com> writes:
>
> Hi Justin,
>
> > I suspect it had subscribed to changes to the $HOME directory for some
> > reason.
>
> Could you pls revert this? I would like to know whether Emacs is still
> busy then with global-auto-revert-mode.
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 780 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 16:18       ` Justin Van Winkle
  2018-10-30 16:58         ` Michael Albinus
@ 2018-10-30 17:32         ` Eli Zaretskii
  2018-10-30 18:54           ` Justin Van Winkle
  1 sibling, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2018-10-30 17:32 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: michael.albinus, 33194

> From: Justin Van Winkle <justin.vanwinkle@gmail.com>
> Date: Tue, 30 Oct 2018 12:18:34 -0400
> Cc: michael.albinus@gmx.de, 33194@debbugs.gnu.org
> 
> To clarify, I was not writing to a file that was open in emacs.  In fact, emacs would use 100% cpu even with no
> files opened, so long as global-auto-revert-mode was activated.

That was clear.  Like I said: auto-revert mode makes Emacs watch
changes to _any_ file in that file's directory.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 17:32         ` Eli Zaretskii
@ 2018-10-30 18:54           ` Justin Van Winkle
  2018-10-30 18:55             ` Justin Van Winkle
  0 siblings, 1 reply; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-30 18:54 UTC (permalink / raw)
  To: eliz; +Cc: michael.albinus, 33194

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

Ok, in that case I wonder if this is actually a bug.

On Tue, Oct 30, 2018 at 1:33 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Justin Van Winkle <justin.vanwinkle@gmail.com>
> > Date: Tue, 30 Oct 2018 12:18:34 -0400
> > Cc: michael.albinus@gmx.de, 33194@debbugs.gnu.org
> >
> > To clarify, I was not writing to a file that was open in emacs.  In
> fact, emacs would use 100% cpu even with no
> > files opened, so long as global-auto-revert-mode was activated.
>
> That was clear.  Like I said: auto-revert mode makes Emacs watch
> changes to _any_ file in that file's directory.
>

[-- Attachment #2: Type: text/html, Size: 1063 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 18:54           ` Justin Van Winkle
@ 2018-10-30 18:55             ` Justin Van Winkle
  2018-11-03 10:57               ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Justin Van Winkle @ 2018-10-30 18:55 UTC (permalink / raw)
  To: eliz; +Cc: michael.albinus, 33194

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

I mean it is certainly a bug to use 100% of a cpu just because a file that
is in the same directory to a file you are editing is being written to, but
it may not be unintentional behavior.

On Tue, Oct 30, 2018 at 2:54 PM Justin Van Winkle <
justin.vanwinkle@gmail.com> wrote:

> Ok, in that case I wonder if this is actually a bug.
>
> On Tue, Oct 30, 2018 at 1:33 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: Justin Van Winkle <justin.vanwinkle@gmail.com>
>> > Date: Tue, 30 Oct 2018 12:18:34 -0400
>> > Cc: michael.albinus@gmx.de, 33194@debbugs.gnu.org
>> >
>> > To clarify, I was not writing to a file that was open in emacs.  In
>> fact, emacs would use 100% cpu even with no
>> > files opened, so long as global-auto-revert-mode was activated.
>>
>> That was clear.  Like I said: auto-revert mode makes Emacs watch
>> changes to _any_ file in that file's directory.
>>
>

[-- Attachment #2: Type: text/html, Size: 1586 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-10-30 18:55             ` Justin Van Winkle
@ 2018-11-03 10:57               ` Michael Albinus
  2018-11-04 11:58                 ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-11-03 10:57 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194

Justin Van Winkle <justin.vanwinkle@gmail.com> writes:

Hi Justin,

> I mean it is certainly a bug to use 100% of a cpu just because a file
> that is in the same directory to a file you are editing is being
> written to, but it may not be unintentional behavior.

I could reproduce the problem. I have a running Emacs for some days, and
I've enabled `global-auto-revert-mode'. Starting scp copy of a large
file outside Emacs, brought Emacs up to 100% cpu usage.

The variable `file-notify-descriptors' contains

#s(hash-table size 97 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((1 . 0) #s(file-notify--watch /home/albinus .emacs auto-revert-notify-handler) (1 . 1) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 2) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 3) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 4) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 5) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 6) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (2 . 0) #s(file-notify--watch /usr/local/src/emacs/src nil auto-revert-notify-handler) (1 . 7) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 8) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 9) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 10) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 11) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 12) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (3 . 0) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 1) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 2) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 3) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 4) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 5) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (1 . 13) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (3 . 6) #s(file-notify--watch /home/albinus/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 7) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 8) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 9) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 10) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (4 . 0) #s(file-notify--watch /usr/local/src/elpa nil auto-revert-notify-handler) (3 . 11) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (5 . 0) #s(file-notify--watch /usr/local/src/emacs-25/doc/misc nil auto-revert-notify-handler) (3 . 12) #s(file-notify--watch /home/albinus/src/elpa/packages/debbugs nil auto-revert-notify-handler) (6 . 0) #s(file-notify--watch /home/albinus/src/tramp/texi nil auto-revert-notify-handler) (6 . 1) #s(file-notify--watch /home/albinus/src/tramp/texi nil auto-revert-notify-handler) (6 . 2) #s(file-notify--watch /home/albinus/src/tramp/texi nil auto-revert-notify-handler) (4 . 1) #s(file-notify--watch /usr/local/src/elpa nil auto-revert-notify-handler) (7 . 0) #s(file-notify--watch /usr/share/info nil auto-revert-notify-handler) (8 . 0) #s(file-notify--watch /home/albinus/src/tramp/lisp nil auto-revert-notify-handler) (8 . 1) #s(file-notify--watch /home/albinus/src/tramp/lisp nil auto-revert-notify-handler) (8 . 2) #s(file-notify--watch /home/albinus/src/tramp/lisp nil auto-revert-notify-handler) (9 . 0) #s(file-notify--watch /home/albinus/src/tramp nil auto-revert-notify-handler) (1 . 14) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 15) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 16) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (4 . 2) #s(file-notify--watch /usr/local/src/elpa nil auto-revert-notify-handler) (4 . 3) #s(file-notify--watch /usr/local/src/elpa nil auto-revert-notify-handler) (3 . 13) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 14) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 15) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 16) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (4 . 4) #s(file-notify--watch /usr/local/src/elpa nil auto-revert-notify-handler) (4 . 5) #s(file-notify--watch /usr/local/src/elpa nil auto-revert-notify-handler) (3 . 17) #s(file-notify--watch /home/albinus/src/elpa/packages/debbugs nil auto-revert-notify-handler) (3 . 18) #s(file-notify--watch /usr/local/src/elpa/packages/debbugs nil auto-revert-notify-handler) (1 . 17) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 18) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 19) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 20) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 21) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 22) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 23) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 24) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 25) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 26) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 27) #s(file-notify--watch /home/albinus .newsrc-dribble auto-revert-notify-handler) (1 . 28) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 29) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (1 . 30) #s(file-notify--watch /home/albinus nil auto-revert-notify-handler) (10 . 0) #s(file-notify--watch /usr/local/share/emacs/27.0.50/lisp filenotify.el.gz auto-revert-notify-handler) (10 . 1) #s(file-notify--watch /usr/local/share/emacs/27.0.50/lisp nil auto-revert-notify-handler)))

As we can see, many identical entries #s(file-notify--watch /home/albinus nil auto-revert-notify-handler).
Every incoming event for "/home/albinus" triggers the many calls of
`auto-revert-notify-handler', although one entry would be sufficient. I
will check, where all these entries come from.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-11-03 10:57               ` Michael Albinus
@ 2018-11-04 11:58                 ` Michael Albinus
  2018-11-05 16:28                   ` Justin Van Winkle
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-11-04 11:58 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Justin,

>> I mean it is certainly a bug to use 100% of a cpu just because a file
>> that is in the same directory to a file you are editing is being
>> written to, but it may not be unintentional behavior.
>
> I could reproduce the problem. I have a running Emacs for some days, and
> I've enabled `global-auto-revert-mode'. Starting scp copy of a large
> file outside Emacs, brought Emacs up to 100% cpu usage.

I have pushed a fix for this to Emacs' master branch in git. The case of
several buffers using the same file notification descriptor was prepared
already in the code; due to a silly bug it didn't work.

> The variable `file-notify-descriptors' contains ...
>
> As we can see, many identical entries #s(file-notify--watch
> /home/albinus nil auto-revert-notify-handler).
> Every incoming event for "/home/albinus" triggers the many calls of
> `auto-revert-notify-handler', although one entry would be sufficient. I
> will check, where all these entries come from.

This doesn't happen any longer for me. And Emacs doesn't eat all cpu
time.

Do you have a chance to build Emacs 27.0.50, for verification?

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-11-04 11:58                 ` Michael Albinus
@ 2018-11-05 16:28                   ` Justin Van Winkle
  2018-11-05 21:18                     ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Justin Van Winkle @ 2018-11-05 16:28 UTC (permalink / raw)
  To: michael.albinus; +Cc: 33194

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

I checked out and installed from master (at
294a5246b264441d436612d4de0dd89fad130aa3).

I still see 100% cpu usage in emacs.

What I did:

In one terminal I run 'emacs' from my home directory, and I don't open any
files.
In another terminal, again while in the home directory, I run 'cat
/dev/zero > zed'.

Emacs cpu usage spikes to 100%.

- Justin

On Sun, Nov 4, 2018 at 6:58 AM Michael Albinus <michael.albinus@gmx.de>
wrote:

> Michael Albinus <michael.albinus@gmx.de> writes:
>
> Hi Justin,
>
> >> I mean it is certainly a bug to use 100% of a cpu just because a file
> >> that is in the same directory to a file you are editing is being
> >> written to, but it may not be unintentional behavior.
> >
> > I could reproduce the problem. I have a running Emacs for some days, and
> > I've enabled `global-auto-revert-mode'. Starting scp copy of a large
> > file outside Emacs, brought Emacs up to 100% cpu usage.
>
> I have pushed a fix for this to Emacs' master branch in git. The case of
> several buffers using the same file notification descriptor was prepared
> already in the code; due to a silly bug it didn't work.
>
> > The variable `file-notify-descriptors' contains ...
> >
> > As we can see, many identical entries #s(file-notify--watch
> > /home/albinus nil auto-revert-notify-handler).
> > Every incoming event for "/home/albinus" triggers the many calls of
> > `auto-revert-notify-handler', although one entry would be sufficient. I
> > will check, where all these entries come from.
>
> This doesn't happen any longer for me. And Emacs doesn't eat all cpu
> time.
>
> Do you have a chance to build Emacs 27.0.50, for verification?
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 2361 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-11-05 16:28                   ` Justin Van Winkle
@ 2018-11-05 21:18                     ` Michael Albinus
  2019-01-04 12:56                       ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2018-11-05 21:18 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194

Justin Van Winkle <justin.vanwinkle@gmail.com> writes:

Hi Justin,

> I checked out and installed from master (at
> 294a5246b264441d436612d4de0dd89fad130aa3).
>
> I still see 100% cpu usage in emacs.
>
> What I did:
>
> In one terminal I run 'emacs' from my home directory, and I don't open
> any files.
> In another terminal, again while in the home directory, I run 'cat
> /dev/zero > zed'.
>
> Emacs cpu usage spikes to 100%.

I've tried to reproduce the problem with the recent Emacs build. I let
cat run for about 6 min; emacs' cpu usage didn't exceed 15% during that
time. The zed file results in

# ls -l zed
-rw-r--r-- 1 albinus albinus 11726983168 Nov  5 22:12 zed

So I cannot confirm your observation, sorry.

Could you pls show exactly your recipe, starting with "emacs -Q"?

> - Justin

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2018-11-05 21:18                     ` Michael Albinus
@ 2019-01-04 12:56                       ` Michael Albinus
  2019-03-28 12:36                         ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2019-01-04 12:56 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Justin,

> So I cannot confirm your observation, sorry.
>
> Could you pls show exactly your recipe, starting with "emacs -Q"?

I'm sorry, but I will close the bug w/o a recipe.

>> - Justin

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

* bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory
  2019-01-04 12:56                       ` Michael Albinus
@ 2019-03-28 12:36                         ` Michael Albinus
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Albinus @ 2019-03-28 12:36 UTC (permalink / raw)
  To: Justin Van Winkle; +Cc: 33194-done

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Justin,
>
>> So I cannot confirm your observation, sorry.
>>
>> Could you pls show exactly your recipe, starting with "emacs -Q"?
>
> I'm sorry, but I will close the bug w/o a recipe.

No reaction for months. I'm closing the bug.

If you could show us new evidences, pls reply to this message, and we'll reopen.

>>> - Justin

Best regards, Michael.





^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2019-03-28 12:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 16:01 bug#33194: 26.1; Auto-revert mode causes emacs to use 100% cpu whenever a file is being written to in the home directory Justin Van Winkle
2018-10-29 20:27 ` Michael Albinus
2018-10-29 21:13   ` Justin Van Winkle
2018-10-29 21:14     ` Justin Van Winkle
2018-10-30  6:21     ` Eli Zaretskii
2018-10-30  8:39       ` Michael Albinus
2018-10-30 10:41         ` Eli Zaretskii
2018-10-30 10:44           ` Michael Albinus
2018-10-30 12:28             ` Eli Zaretskii
2018-10-30 13:12               ` Michael Albinus
2018-10-30 16:18       ` Justin Van Winkle
2018-10-30 16:58         ` Michael Albinus
2018-10-30 17:02           ` Justin Van Winkle
2018-10-30 17:08             ` Michael Albinus
2018-10-30 17:09               ` Justin Van Winkle
2018-10-30 17:32         ` Eli Zaretskii
2018-10-30 18:54           ` Justin Van Winkle
2018-10-30 18:55             ` Justin Van Winkle
2018-11-03 10:57               ` Michael Albinus
2018-11-04 11:58                 ` Michael Albinus
2018-11-05 16:28                   ` Justin Van Winkle
2018-11-05 21:18                     ` Michael Albinus
2019-01-04 12:56                       ` Michael Albinus
2019-03-28 12:36                         ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).