GNU bug report logs -
#73855
[PATCH] * lisp/autorevert.el: Avoid reverting buffer in short time
Previous Next
Reported by: Lin Sun <sunlin7.mail <at> gmail.com>
Date: Thu, 17 Oct 2024 23:28:01 UTC
Severity: normal
Tags: patch
Merged with 74490,
74491
Fixed in versions 31.1, 31.0.50
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 73855 <at> debbugs.gnu.org (full text, mbox):
Lin Sun <sunlin7.mail <at> gmail.com> writes:
> Hi,
Hi,
> High CPU consumption after enabling the "auto-revert" for a buffer.
> Here is a way to reproduce the issue:
> 1. on one terminal run command "strace -f -o /tmp/a.log vi -nw"
> 2. on second terminal, start another emacs and open the file
> /tmp/a.log, enable the "auto-revert" mode on the /tmp/a.log buffer.
>
> Typing on 1st terminal(vi), the strace will continually write the
> /tmp/a.log, and the emacs try to revert the /tmp/a.log buffer again
> and again, then CPU loading turns high.
>
> The function `auto-revert-handler` may be called twice for 2.5 seconds
> intervals on a rapidly changed buffer/file.
>
> The root cause is `auto-revert--end-lockout` will call
> `auto-revert-handler` in which the `auto-revert--lockout-timer` was
> cleared, then the next call `auto-revert-notify-handler` will revert
> the buffer immediately regardless the buffer actually was revert just
> before.
>
> This patch will record when the buffer was reverted and avoid
> reverting it again in the same second.
There is no bug. If auto-revert-use-notify is non-nil, file
notifications are in game, which are *supposed* to revert
immediately. No delay is wanted.
In your case, where mass write happens to a file, I recommend to set
auto-revert-use-notify to nil. Polling is used then instead, with
auto-revert-interval interval between reverts. The default value is 5
(seconds), you might change it to 1.
Furthermore, your use case doesn't look ideal for enabling
auto-revert-mode. Checking fast changing log files is better done with
auto-revert-tail-mode.
Best regards, Michael.
This bug report was last modified 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.