CPU usage so high, fread() on the FILE wrapped by libfetch's fetchXGetURL()

Yanhui Shen shen.elf at gmail.com
Sun Apr 22 11:54:18 UTC 2012


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 at ThinkPad:/usr/obj/usr/src/sys/ThinkPad  amd64

-- 
Best regards,
Yanhui Shen


More information about the freebsd-hackers mailing list