Subject: bug#32523: 27.0.50; Emacs hangs when killing rectangle

From: Stefan Kangas <[email-masked]>
Date: Fri, 21 Aug 2020 04:51:37 -0700

Joseph Mingrone <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>>> From: Joseph Mingrone <[email-masked]>
>>> Date: Fri, 24 Aug 2018 21:59:48 -0300
>
>>> Here is a recipe to make Emacs (nearly) hang indefinitely.
>
>>> 1. emacs -Q
>
>>> 2. Visit the file found https://ftfl.ca/misc/big_file_hangs_emacs.txt
>
>>> 3. M-x toggle-truncate-lines
>
>>> 4. Use rectangle-mark-mode (C-x SPC) to mark the rectangle that starts
>>>    at the top left of the file (point 1), and includes the leading white
>>>    space, the line numbers, and the space after the line numbers (point
>>>    468848).
>
>>> 5. Kill the rectangle with C-x r k.
>
>>> For me, the Emacs process will continue to use 100% CPU and Emacs is
>>> almost completely unresponsive and has to be killed.  Some actions such
>>> as saving the file may complete, but only after a few minutes.
>
>> It doesn't hang, it just takes very long to finish that operation (3
>> min on my machine with an unoptimized build; should be something like
>> 1 to 1.5 min in an optimized build).
>
>> This belongs to the "Emacs is very slow with long lines" class of
>> problems: the file has 2900-character lines.  If this file will never
>> include any text, I suggest to visit it with
>> "M-x find-file-literally", then the problem of slowness will go away.
>
> Thanks for the `find-file-literally' tip.
>
> The rectangle does eventually get cut for me as well.  Ignoring speed,
> the problem is that Emacs is unusable afterwards.  For example, if I go
> away for an hour or so, then return, the Emacs process will still be
> using something close to 100% CPU and trying to doing something simple,
> like moving the point forward, may take minutes.

Are you still seeing this behaviour?

If yes, could you try to run the profiler to see what Emacs is spending
so much time doing?

Best regards,
Stefan Kangas