zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: It seems that I find a zle -F full CPU bug
Date: Wed, 19 Feb 2014 23:30:52 -0800	[thread overview]
Message-ID: <CAH+w=7Z+R_ZexSkesp2z+ndooHStOGJcMeWXtD7HCunjqJp9-Q@mail.gmail.com> (raw)
In-Reply-To: <20140220050415.GA29027@lilyforest>

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

On Wednesday, February 19, 2014, lilydjwg <lilydjwg@gmail.com> 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?

  reply	other threads:[~2014-02-20  7:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20  5:04 lilydjwg
2014-02-20  7:30 ` Bart Schaefer [this message]
2014-02-20  9:40   ` Peter Stephenson
2014-02-20 13:16     ` lilydjwg
2014-07-16 13:55       ` Nick Cross
2014-07-16 16:01         ` Bart Schaefer
2014-07-16 17:10           ` Nick Cross
2014-07-16 17:50             ` Bart Schaefer
2014-07-17 13:52               ` Nick Cross
2014-07-17 15:52                 ` Dominic Hopf
2014-07-17 17:18                   ` Bart Schaefer
2014-07-17 18:30                     ` Dominic Hopf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Z+R_ZexSkesp2z+ndooHStOGJcMeWXtD7HCunjqJp9-Q@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).