From owner-freebsd-hackers@FreeBSD.ORG Thu May 3 19:05:02 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94608106566B for ; Thu, 3 May 2012 19:05:02 +0000 (UTC) (envelope-from bryan@shatow.net) Received: from secure.xzibition.com (secure.xzibition.com [173.160.118.92]) by mx1.freebsd.org (Postfix) with ESMTP id 368858FC0C for ; Thu, 3 May 2012 19:05:02 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=shatow.net; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=sweb; b=rbg/Wu 4hb+R2i2eMVGF+dPhUaSzF/+1ZLHklSuCeyHp6QjdwkGxQ4RQwl/PH+Mirr/TOIA CkL51kn/+xAiGGsk2vahkQOsNXCv153e1bJt0rQKdVvLnF4fPz3jMjE9i7VEL+Fb xh2+OFEVNHFWJ49TC7ebAH96ePoSjfsIkvKnE= DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=shatow.net; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; s=sweb; bh=aNg31I/GEqqR jONvxHK6yvlValffqLyO7JSl3AO9fv4=; b=mWTsUFYbrVVJ0n2WDN0nazpiJv1j 1t06f6R2EQQ4Rb6t4waHpWUcP/oaH+Y64lLkWSlsoD+qhpC3vNeei7D7E1FCp9HH g91l59pzvjWH12XFPOYgwYpNiR/fb3cPEdCtBHIgXcYDtkPOiw0i8N4mqELpZrpo qWy233VLGECeZVg= Received: (qmail 29662 invoked from network); 3 May 2012 14:05:00 -0500 Received: from unknown (HELO ?192.168.0.107?) (bryan@shatow.net@74.94.87.209) by sweb.xzibition.com with ESMTPA; 3 May 2012 14:05:00 -0500 Message-ID: <4FA2D6DB.70404@shatow.net> Date: Thu, 03 May 2012 14:04:59 -0500 From: Bryan Drewery User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Yanhui Shen References: In-Reply-To: X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: CPU usage so high, fread() on the FILE wrapped by libfetch's fetchXGetURL() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2012 19:05:02 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 04/22/2012 06:54 AM, Yanhui Shen wrote: > Hi, > > I found the CPU usage is pretty high while running 'pkg update', > 'pkg install [fooapp]'. Seems it was caused by fread() on the FILE > wrapped by libfetch's fetchXGetURL() , maybe fetch_read() in > common.c. > > Here is a simple test code: http://pastebin.com/2sP1f4Wv I want to > know whether it is a bug, or misuse of libfetch API, or any other > matter? > > Run and look about its CPU usage (HTTP url has this issue, FTP url > has not): % ./a.out > http://mirrors.163.com/FreeBSD/ISO-IMAGES-amd64/8.3/FreeBSD-8.3-RELEASE-amd64-bootonly.iso > > Env: % uname -a FreeBSD ThinkPad 9.0-STABLE FreeBSD 9.0-STABLE #1: > Tue Apr 10 12:46:50 CST 2012 > shen@ThinkPad:/usr/obj/usr/src/sys/ThinkPad amd64 > Turns out that setting fetchTimeout > 0 fixes this problem. It's been set to 30 in pkgng now. Regards, Bryan Drewery -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJPotbaAAoJEG54KsA8mwz5WxUP/iSMjLAShaF/t9+WYtj10FPK 7WWnFj1iquJYN+g0JCDtFnzpqB/VvEfY9sTLqKp/TxCBePS1qPHExzXw9vbFMBDK Em2LCZrlva5vNX7U0vx77dFUJXAEW8zLs6XFeDsmlUBK9CYDK7mDoxNKcLq3LV9w QWOhiTpTe2RprRMqz9FOhQmZ2dB9t5oSuG8BgcEWTfnGS8ANPM45wGH7Vhimai1z 8OCw0T8ZAI7KqDyvxZigACIRWIRb02vBuzVAG1g6EgoVlYQQOwAtH7aCrXaauzlX uWHTjJZYdAl2Lrl60q7qYfyjwFgyVnQIJCEijmT/ydvOMT4huTQrHXvMUiez9qPU wri+6UefQY61C+TVtLMROWlBuCuH4japwxyIlf8QdLbruehcnHjTpFyHDzJMmAj5 V2YU+EfgjOVhoSKyOIQC5VBqK27FlaFMuisD4xisdpJDCJ9k8/LsAjH/PsQwdvei a6CEn3SpMAzrhF3ukv57xIwxSDXdsyoU2VhED5rmrtqzrEFvFjMlflg9MWWHx2m1 KUgmj0ls+WugJrFw/E7PzRU8Qd0xCQRvplDYde16Kzkz+hpXpV6LBYQfWG+YnrRx 5kiJhvNrr7Dstv7Q8u9jNu17KZGSI5p5+FX5oereKymlFxl42rKwyguLXAfHDCXP 1R/HHmtqFSNjSgICw4uC =qd8F -----END PGP SIGNATURE-----