Subject: bug#49253: 27.2; Emacs non-responsive when pasting into terminal-mode

From: Matt Bisson <[email-masked]>
Date: Mon, 28 Jun 2021 14:11:56 -0400

> Some input Emacs gets fed at startup, which it doesn't expect, and
> which looks like a beginning of a paste sequence?  This does happen
> right at startup, yes?

No.  (Unless I'm misunderstanding what you're asking) the problem can
occur at any time.  It's in response to simply pasting from the
clipboard into a terminal application.  I can start Emacs, run for
days normally -- using terminal-mode, editing files, and so forth.
The second I go into the terminal-mode buffer and paste from the
(Windows, Mac, whatever) clipboard (NOT using the Emacs yank command),
the problem happens.  If I never paste from the windowing system into
my terminal emulator, there are not problems, but invariably I find
some huge chunk of text, go to paste it into Emacs, and forget that
this will be a problem, and everything locks up irreversibly.  It is
as if there is some race with multiple parties asking for select(),
but I don't know the Emacs threading model yet.  TBH, I assumed it was
kind of single-threaded. :)

If your statement is more that the beginning of the sequence retrieved
from the xterm paste incantation occurs "at the start", then for that
I will have to debug into GDB, as we talked about.

> No, it's the other way around: you start Emacs from GDB.  There are
> some instructions in etc/DEBUG.

Yes, I do know that's what you mean :) but it's not as if Emacs is
going to crash, and stop in the debugger.  So my question is
basically, what src/*.c line should I set a breakpoint on to observe
the thing you would like me to observe?  If you can't say, that's
perfectly reasonable.  That said, as I type this, I can try to
interrupt Emacs when it's hung and see anything that's going on, but I
believe it will be after the problematic event has occurred.

On Mon, Jun 28, 2021 at 2:00 PM Eli Zaretskii <[email-masked]> wrote:
>
> > From: Matt Bisson <[email-masked]>
> > Date: Mon, 28 Jun 2021 13:30:19 -0400
> > Cc: [email-masked]
> >
> > Looking at the (E-Lisp) function, it's not obvious to me where I
> > should put a (native-code) breakpoint.  Any thought?  Of course I can
> > figure something out, but if you happen to know...
>
> No, it's the other way around: you start Emacs from GDB.  There are
> some instructions in etc/DEBUG.