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

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

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

I'm using zsh 5.0.5 on Arch Linux x86_64.

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

Best regards,

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