From owner-freebsd-stable@FreeBSD.ORG Sun Sep 18 00:08:09 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 147F2106566C for ; Sun, 18 Sep 2011 00:08:09 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from fep32.mx.upcmail.net (fep32.mx.upcmail.net [62.179.121.50]) by mx1.freebsd.org (Postfix) with ESMTP id 5B69C8FC13 for ; Sun, 18 Sep 2011 00:08:08 +0000 (UTC) Received: from edge01.upcmail.net ([192.168.13.236]) by viefep11-int.chello.at (InterMail vM.8.01.02.02 201-2260-120-106-20100312) with ESMTP id <20110917234917.TWJF1647.viefep11-int.chello.at@edge01.upcmail.net> for ; Sun, 18 Sep 2011 01:49:17 +0200 Received: from pinky ([213.93.232.119]) by edge01.upcmail.net with edge id ZzpF1h01M2bDWHx01zpGbX; Sun, 18 Sep 2011 01:49:17 +0200 X-SourceIP: 213.93.232.119 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Date: Sun, 18 Sep 2011 01:49:15 +0200 To: "freebsd-stable@freebsd.org" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Ronald Klop" Message-ID: User-Agent: Opera Mail/11.51 (Win32) X-Cloudmark-Analysis: v=1.1 cv=tTYK/jEx3Md0ap/a1mcLk8+jVCgK8N5hzJ/RRDoBXsA= c=1 sm=0 a=lm4eusMn8AwA:10 a=uDcH3jlizGIA:10 a=bgpUlknNv7MA:10 a=kj9zAlcOel0A:10 a=a14uRV0-AAAA:8 a=Cxax_i-7n5q4WilytRIA:9 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Subject: /usr/bin/script eating 100% cpu with portupgrade and xargs X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 00:08:09 -0000 Hi, I'm running portupgrade in screen to update all the ports for 9-BETA2/9-CURRENT on amd64. While doing this script eats 100% cpu. Because portupgrade -fa crashed I'm running this command to update the remaining non-updates ports. find /var/db/pkg -name +DESC -mtime +2 |cut -d / -f 5 | xargs time nice -n 20 portupgrade -f The output of truss -p `pgrep script` is this: clock_gettime(13,{1316301104.000000000 }) = 0 (0x0) select(5,{0 4},0x0,0x0,{30.000000 }) = 1 (0x1) read(0,0x7fffffffcdf0,1024) = 0 (0x0) write(4,0x7fffffffcdf0,0) = 0 (0x0) clock_gettime(13,{1316301104.000000000 }) = 0 (0x0) select(5,{0 4},0x0,0x0,{30.000000 }) = 1 (0x1) read(0,0x7fffffffcdf0,1024) = 0 (0x0) write(4,0x7fffffffcdf0,0) = 0 (0x0) clock_gettime(13,{1316301104.000000000 }) = 0 (0x0) select(5,{0 4},0x0,0x0,{30.000000 }) = 1 (0x1) read(0,0x7fffffffcdf0,1024) = 0 (0x0) write(4,0x7fffffffcdf0,0) = 0 (0x0) clock_gettime(13,{1316301104.000000000 }) = 0 (0x0) select(5,{0 4},0x0,0x0,{30.000000 }) = 1 (0x1) read(0,0x7fffffffcdf0,1024) = 0 (0x0) write(4,0x7fffffffcdf0,0) = 0 (0x0) So it is really fast in reading and writing 0 bytes most of the time. I also found http://web.archiveorange.com/archive/v/6ETvLvjo60Gj9geAUAb6 and I think I am better of by rewriting my command so stdin/stdout is still the terminal. Although the link is a couple of years old. Is this known? Can somebody explain me why my xargs command is not working well? Ronald.