zsh-users
 help / color / mirror / code / Atom feed
* It seems that I find a zle -F full CPU bug
@ 2014-02-20  5:04 lilydjwg
  2014-02-20  7:30 ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: lilydjwg @ 2014-02-20  5:04 UTC (permalink / raw)
  To: zsh-users

Hi there,

I get to know "zle -F" from the mail by Bart Schaefer[1], but it seems
that I find a bug in zle.

I use similar code to achieve the background updating, but after the
update and *before* I type anything into zsh again, zsh is busy poll the
coprocess's file descriptor, which has been invalid.

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.

You can type the following to reproduce this:

print_and_close () {
  print $*
  zle -F $1
  exec {1}>&-
}
coproc echo "a"
exec {test}<&p
zle -F $test print_and_close

Now zsh is eating a lot of CPU. Type anything and it will become normal
again.

I'm using zsh 5.0.5 on Arch Linux x86_64.

[1]: http://www.zsh.org/mla/users/2014/msg00204.html

-- 
Best regards,
lilydjwg


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-07-17 18:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20  5:04 It seems that I find a zle -F full CPU bug lilydjwg
2014-02-20  7:30 ` Bart Schaefer
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

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).