Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: It seems that I find a zle -F full CPU bug

On Wednesday, February 19, 2014, lilydjwg <lilydjwg@xxxxxxxxx> wrote:
> I've checked Src/Zle/zle_main.c and see a "for(;;)" loop. That loop will
> break only when no fds are ready, or the user types something. So,
> before the user types something and after the watched fd becomes
> invalid, zsh keeps poll that fd and gets lots of POLLNVAL.

Although it would be better if zsh did not begin hogging the CPU, it's
possible for that closed descriptor to be re-opened again (e.g. by a signal
handler), so unless we are willing to ignore that I'm not sure what to do.
 I suppose we could drop the fd on the first POLLNVAL for the duration of
that particular loop, but then reinstate it before restarting the loop
after the next user input.  Or something more complicated where we drop it
for only one call to poll() that has an artificial timeout to limit how
long it can be before we discover that the fd is valid again.

I don't think we want to go so far as to make it an error to pass a closed
fd to zle -F ... and that wouldn't help in this case anyway?

Messages sorted by: Reverse Date, Date, Thread, Author