#13259 closed defect (fixed)
lftp crashes on Mac OS X 10.5 Leopard: 99% CPU usage due to bad poll()
Reported by: | dackze@… | Owned by: | nox@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.5.0 |
Keywords: | lftp | Cc: | dackze@…, nox@…, simon@…, mjhsieh (Mengjuei Hsieh), yunzheng.hu@… |
Port: |
Description
On Leopard, lftp uses 99% CPU when idle due to poll() failing when being called on the tty device. You can see this with Instruments if you record lftp running with the "CPU Sampler" trace document, check "Invert Call Tree" and sort by "Total %". You can see it's on a tty with a dtrace script like "syscall::poll:entry { trace(fds[*(uint32_t *)copyin(arg0, 4)].fi_pathname); }".
lftp's configure script only uses its own poll() implementation if Darwin 8.* is being used, but Leopard is Darwin 9.0.0. Patching the configure script to add in a check for that doesn't actually seem to work for me though, as lftp still links to _poll$UNIX2003 and doesn't use its own implementation. I even went so far as to patch m4/lftp.m4's poll() test to account for the failure on device files, but it still ends up linking to _poll$UNIX2003. At this point I have no idea how to fix it. I'd appreciate it if someone else could take a look. I can post patches I've been messing with, if need be.
Attachments (3)
Change History (13)
comment:1 Changed 17 years ago by nox@…
Cc: | dackze@… nox@… added |
---|---|
Milestone: | → Port Bugs |
Summary: | lftp on 10.5 - 99% CPU usage due to bad poll() → lftp crashes on Mac OS X 10.5 Leopard: 99% CPU usage due to bad poll() |
comment:2 Changed 17 years ago by dackze macports@…
It's patched upstream in CVS, in revision 1.11 of m4/lftp.m4. The patch adds a test for poll() on devices.
I haven't been able to get its autogen.sh working on OS X though, so I haven't been able to test the patch.
comment:3 Changed 17 years ago by simon@…
Cc: | simon@… added |
---|
I updated lftp to version 3.6.1 ([31561]). But I'm not sure if this fixed this problem.
Simon
comment:4 Changed 17 years ago by mjhsieh (Mengjuei Hsieh)
I confirm that v3.6.1 DOES NOT fix this problem.
comment:5 Changed 17 years ago by nox@…
Cc: | mjhsieh@… added |
---|---|
Owner: | changed from macports-tickets@… to nox@… |
Could you please try the following command?
sudo port -d build lftp configure.post_args="lftp_cv_func_poll_works=no"
comment:6 Changed 17 years ago by mjhsieh@…
The result is the same.
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_lftp\ /work/lftp-3.6.1/src/lftp lftp :~>
in the other window,... the top still shows
PID UID REG RPRVT RSHRD RSIZE VPRVT VSIZE TH PRT TIME %CPU COMMAND 26754 501 51 352K 184K 1456K 74M 79M 1 13 8m11s 99.9 lftp
comment:7 Changed 17 years ago by yunzheng.hu@…
Sorry i opened up a new trac ticket a few days ago without checking first: #14242
I located the problem, and have a fix in that ticket.
comment:8 Changed 17 years ago by yunzheng.hu@…
(Moving my initial comments of my ticket #14242 to this one.)
When compiling and running lftp on Leopard it causes the 'known' 100% cpu usage. This however is not entirely related to the 'poll' bug, like in Tiger.
I have attached a patch for configure that detects the broken poll on Leopard as well. And a modification to the Portfile that sets the MACOSX_DEPLOYMENT_TARGET=10.4, which fixes the cpu usage issue on Leopard.
references to the bug in Tiger:
http://www.mail-archive.com/lftp%40uniyar.ac.ru/msg02101.html
same patch but for Leopard (but does not entirely fix the problem):
http://www.mail-archive.com/lftp@uniyar.ac.ru/msg03091.html
Changed 17 years ago by yunzheng.hu@…
Modified Portfile that fixes the bug on leopard, also took maintainership (currently nomaintainer)
Changed 17 years ago by yunzheng.hu@…
Attachment: | patch-configure added |
---|
patch for configure that also applies to Darwin 9 instead of only Darwin 8 (the poll issue)
comment:9 Changed 17 years ago by simon@…
Cc: | yunzheng.hu@… added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Committed in [34174]. I also added you as maintainer. Thanks for your help.
Simon
Have you reported this bug upstream?