Subject: Re: bug#49714: 28.0.50; TRAMP burns CPU and has insufficient user reporting when using xxxx-sk SSH keys

From: Michael Albinus <[email-masked]>
Date: Sat, 24 Jul 2021 20:30:07 +0200

Dima Kogan <[email-masked]> writes:

Hi Dima,

>>> 1. Emacs should not be spinning the CPU. This is actually an old bug. I
>>>    usually see this with normal SSH connections, but it only happens
>>>    during the login sequence, which isn't very long. In THIS case the
>>>    login sequence could be longer. In any case, we shouldn't be
>>>    spinning.
>>
>> Not so simple. Tramp is in a loop, reading the process output, and
>> checking, whether there is something it has to handle (for example,
>> password requests). This loop runs until Tramp detects the remote shell
>> prompt.
>
> There should be a loop, but emacs shouldn't be using all my CPU cycles
> while waiting for user interaction. Emacs can select() on the ssh
> process file descriptor, and sleep until the ssh process has stuff to
> say.

Well, I'm on Lisp level. I just have accept-process-output, and in my
loop I check whether there is new output. There's no low level API to
let Emacs sleep for the ssh process file descriptor.