+++ This bug was initially created as a clone of Bug #1437014 +++ Description of problem: When there is at least one process in the system running that has many open file descriptors and many threads lsof -nP takes a a lot of time to run and produces huge output. Version-Release number of selected component (if applicable): lsof-4.89-5.fc26 How reproducible: Always Steps to Reproduce: 1. lsof -nP Actual results: Takes a long time to traverse all threads of all processes. Expected results: Only traverse processes, unless -K flag is given. --- Additional comment from Marcus Sundberg on 2017-03-29 05:41 EDT --- --- Additional comment from Marcus Sundberg on 2017-03-29 05:44 EDT --- --- Additional comment from Marcus Sundberg on 2017-03-29 05:46:15 EDT --- Example running standard and patched lsof in an EL7 desktop session: Standard EL7 lsof: $) time lsof -nP | wc -c 14117646 real 0m1.430s user 0m0.648s sys 0m0.789s $) ./fd-and-threads & [1] 30452 $) time lsof -nP | wc -c 75110357 real 0m13.096s user 0m4.128s sys 0m8.968s $) Patched lsof: $) time lsof -nP | wc -c 1748246 real 0m0.214s user 0m0.087s sys 0m0.131s $) ./fd-and-threads & [1] 31585 $) time lsof -nP | wc -c 1822372 real 0m0.247s user 0m0.087s sys 0m0.162s $) time lsof -nPK | wc -c 68403949 real 0m12.946s user 0m4.125s sys 0m8.828s $)
See attachment 1267267 [details] for the fd-and-threads sample program.
The issue is the same in Fedora 24, Fedora 25 and rawhide. Feel free to clone as desired.
Created attachment 1267269 [details] Patch to only list threads/tasks if the -K flag is given.
Marcus, thanks for the bug and the patch! Can I ask - did you contacted upstream about this problem? If not, could you? Try to send him an explanation with sample program and the patch. If he accepts it (or modified version), please, let me know. Thanks, peter
Forgot to mention, here's his home page with email address: https://people.freebsd.org/~abe/
Marcus, were you able to talk to the upstream?
There is apparently a pre-release of lsof 4.90 which has a new -Ki option that disables listing threads: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/NEW/lsof_4.90C.linux.tar.bz2 I tried to argue that omitting threads should be the default, but he disagreed with the motivation that lsof has always listed "everything" by default. Would you prefer a patch backporting the -Ki option instead of my current patch?
Hi Marcus, thanks for the update. If you could provide a patch backporting the -Ki option from upstream, I'll update rawhide and f26 builds. (Please don't forget to update the man page as well.) Thank you. peter
New version of lsof including the patch from upstream is now available in rawhide: https://koji.fedoraproject.org/koji/buildinfo?buildID=1048147
This message is a reminder that Fedora 26 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 26. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '26'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 26 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.