From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16544 invoked by alias); 20 Feb 2014 05:05:09 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18495 Received: (qmail 4177 invoked from network); 20 Feb 2014 05:05:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:disposition-notification-to:user-agent; bh=MBoE5EBsAGGVoMmB611Dp+QSDlRFc8hONPV5d1GDLu0=; b=GpTxVtLI0KGzaMjHKe5Q17EoGl4rIlLj5yk8C1d707TdDwjgXy7dtkmAOwu0g7mG8X 3ADDFBG0usPwJzIz2D53QfkHZU401TCEqEF/v7kR7u/avifp8Rfl91Ze1meRI+dZ2xMt wdk4aaxoMiYLTlvM4b0v8O8yr+Yh6xre4yKdOqeZHVnofsu+XM7gBS8pnwMEM4bz80Bt yqMO+Q1Ye3FD9HoaiwDKZonbVbnZjsJQChoteTLzet2yTqM4DUAob5QXHW/u9WInh1ta SjKNKRytK4+GY8A/1RSeEkGTUjvzt7QlV4nP+98kS79Bg/du30ArY701cdfXJ5uwuecg V8sQ== X-Received: by 10.68.11.199 with SMTP id s7mr44468945pbb.12.1392872701120; Wed, 19 Feb 2014 21:05:01 -0800 (PST) Date: Thu, 20 Feb 2014 13:04:15 +0800 From: lilydjwg To: zsh-users@zsh.org Subject: It seems that I find a zle -F full CPU bug Message-ID: <20140220050415.GA29027@lilyforest> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.22 (2013-10-16) 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