GNU bug report logs - #18696
Emacs freezes for a while visitin Conf (.ini)) buffers

Previous Next

Package: emacs;

Reported by: Angelo Graziosi <angelo.graziosi <at> alice.it>

Date: Sun, 12 Oct 2014 08:25:02 UTC

Severity: normal

Tags: moreinfo

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 18696 in the body.
You can then email your comments to 18696 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#18696; Package emacs. (Sun, 12 Oct 2014 08:25:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Angelo Graziosi <angelo.graziosi <at> alice.it>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 12 Oct 2014 08:25:03 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: bug-gnu-emacs <at> gnu.org
Subject: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Sun, 12 Oct 2014 10:24:18 +0200
I have see this trying to visit Cygwin setup.ini files [*], for example:

  ftp://mirrors.kernel.org/sourceware/cygwin/x86_64/setup.ini


(it is a file of about 2.5 MiB).

After C-x C-f setup.ini, Emacs freezes (or hangs, if you prefer) and 
does not respond for a while (> 1 minute), CPU is at 80-100%. Then it 
works fine. Maybe it is processing the file but I wonder if this 
'freezing' is to be expected.

I have experimented this with Cygwin and MSYS2-MinGW64 builds.


Ciao,
 Angelo.

---
[*] Mode line shows it is in Config[Colon] mode




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18696; Package emacs. (Sun, 12 Oct 2014 08:37:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 18696 <at> debbugs.gnu.org
Subject: Re: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Sun, 12 Oct 2014 11:36:41 +0300
> Date: Sun, 12 Oct 2014 10:24:18 +0200
> From: Angelo Graziosi <angelo.graziosi <at> alice.it>
> 
> I have see this trying to visit Cygwin setup.ini files [*], for example:
> 
>    ftp://mirrors.kernel.org/sourceware/cygwin/x86_64/setup.ini
> 
> 
> (it is a file of about 2.5 MiB).
> 
> After C-x C-f setup.ini, Emacs freezes (or hangs, if you prefer) and 
> does not respond for a while (> 1 minute), CPU is at 80-100%. Then it 
> works fine. Maybe it is processing the file but I wonder if this 
> 'freezing' is to be expected.

If this is in "emacs -Q", then I cannot reproduce this in a MinGW
build.  (You didn't say which version, so I tried the 24.3.94 pretest
and a recent trunk.)

If this is not in "emacs -Q", there's likely some optional feature
that causes that.

In any case, attaching a debugger during the freeze and looking what
does the main thread do should shed some light on this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18696; Package emacs. (Sun, 12 Oct 2014 10:25:03 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18696 <at> debbugs.gnu.org
Subject: Re: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Sun, 12 Oct 2014 12:24:51 +0200

Il 12/10/2014 10:36, Eli Zaretskii ha scritto:
>
> If this is not in "emacs -Q", there's likely some optional feature
> that causes that.

Indeed.. it is this in my initialization file:

  (which-function-mode t)


and, considering the structure of that setup.ini file, this 'freezing' 
could be expected..


Thanks,
 Angelo.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18696; Package emacs. (Tue, 14 Oct 2014 18:44:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 18696 <at> debbugs.gnu.org
Subject: Re: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Tue, 14 Oct 2014 14:43:49 -0400
> Indeed.. it is this in my initialization file:
>   (which-function-mode t)
> and, considering the structure of that setup.ini file, this 'freezing' could
> be expected..

Actually IIUC which-function-mode shouldn't cause such a slow down.
If it does, it's probably because the major mode doesn't have special
support for which-function-mode, so it falls back on using imenu's
support, i.e. it needs to scan the whole buffer.

This said, scanning the whole buffer shouldn't be that sow, unless you
really have very many sections.  So it might also simply be a bug in the
way the major mode supports imenu (e.g. the regexp used is inefficient).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18696; Package emacs. (Thu, 19 Aug 2021 14:56:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 18696 <at> debbugs.gnu.org,
 Angelo Graziosi <angelo.graziosi <at> alice.it>
Subject: Re: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Thu, 19 Aug 2021 16:55:12 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> Actually IIUC which-function-mode shouldn't cause such a slow down.
> If it does, it's probably because the major mode doesn't have special
> support for which-function-mode, so it falls back on using imenu's
> support, i.e. it needs to scan the whole buffer.
>
> This said, scanning the whole buffer shouldn't be that sow, unless you
> really have very many sections.  So it might also simply be a bug in the
> way the major mode supports imenu (e.g. the regexp used is inefficient).

I can reproduce this problem in Emacs 28:

curl https://mirrors.kernel.org/sourceware/cygwin/x86_64/setup.ini > /tmp/setup.ini
./src/emacs -f which-function-mode -Q /tmp/setup.ini
y

Emacs hangs completely, and even `C-g' doesn't help.

The major mode here is conf-colon-mode, which does:

  (setq-local imenu-generic-expression
	      `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
	        ,@(cdr imenu-generic-expression))))

And, indeed, removing that make the file open in a couple of seconds
instead of taking forever (where "forever" is defined as "longer than I
had patience to wait").

Hm...  That regexp does have some backtracking in it, but this is
an 18MB file where 99.997% of the lines match the regexp:

sdesc: "Debug info for 2048-cli"
ldesc: "This package contains files necessary for debugging the
2048-cli package with gdb."
category: Debug
requires: cygwin-debuginfo
version: 0.9.1-1

etc.

So no matter how efficient the regexp is, it's gonna hang here.

Perhaps `imenu-default-create-index-function' should just give up after
spending more than x seconds?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 19 Aug 2021 14:56:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18696; Package emacs. (Thu, 19 Aug 2021 15:43:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Angelo Graziosi <angelo.graziosi <at> alice.it>,
 Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 18696 <at> debbugs.gnu.org
Subject: Re: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Thu, 19 Aug 2021 17:42:17 +0200
On Aug 19 2021, Lars Ingebrigtsen wrote:

> 	      `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)

Does that work better?

                              "^[ \t]*\\([^ \t].*?\\)[ \t]*:"

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18696; Package emacs. (Thu, 19 Aug 2021 15:53:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Angelo Graziosi <angelo.graziosi <at> alice.it>,
 Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 18696 <at> debbugs.gnu.org
Subject: Re: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Thu, 19 Aug 2021 17:52:31 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> On Aug 19 2021, Lars Ingebrigtsen wrote:
>
>> 	      `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
>
> Does that work better?
>
>                               "^[ \t]*\\([^ \t].*?\\)[ \t]*:"

It's probably an improvement, but it's still very slow.  (I.e., I
stopped it after half a minute, and it was still going.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18696; Package emacs. (Fri, 17 Sep 2021 15:55:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 18696 <at> debbugs.gnu.org,
 Angelo Graziosi <angelo.graziosi <at> alice.it>
Subject: Re: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Fri, 17 Sep 2021 17:54:36 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Perhaps `imenu-default-create-index-function' should just give up after
> spending more than x seconds?

I've now done this in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 18696 <at> debbugs.gnu.org and Angelo Graziosi <angelo.graziosi <at> alice.it> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 17 Sep 2021 15:55:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 16 Oct 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 303 days ago.

Previous Next


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