Bug 1437018 - lsof -nP is unusable on Fedora when a multi threaded process has many files open
Summary: lsof -nP is unusable on Fedora when a multi threaded process has many files open
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: lsof
Version: 26
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Rybar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-29 09:50 UTC by Marcus Sundberg
Modified: 2018-05-29 11:59 UTC (History)
4 users (show)

Fixed In Version:
Clone Of: 1437014
Environment:
Last Closed: 2018-05-29 11:59:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch to only list threads/tasks if the -K flag is given. (975 bytes, patch)
2017-03-29 09:55 UTC, Marcus Sundberg
no flags Details | Diff

Description Marcus Sundberg 2017-03-29 09:50:04 UTC
+++ 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
$)

Comment 1 Marcus Sundberg 2017-03-29 09:52:21 UTC
See attachment 1267267 [details] for the fd-and-threads sample program.

Comment 2 Marcus Sundberg 2017-03-29 09:53:25 UTC
The issue is the same in Fedora 24, Fedora 25 and rawhide. Feel free to
clone as desired.

Comment 3 Marcus Sundberg 2017-03-29 09:55:15 UTC
Created attachment 1267269 [details]
Patch to only list threads/tasks if the -K flag is given.

Comment 4 Peter Schiffer 2017-03-30 07:36:21 UTC
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

Comment 5 Peter Schiffer 2017-03-30 07:36:58 UTC
Forgot to mention, here's his home page with email address: https://people.freebsd.org/~abe/

Comment 6 Peter Schiffer 2017-05-19 15:12:03 UTC
Marcus, were you able to talk to the upstream?

Comment 7 Marcus Sundberg 2017-05-31 13:24:09 UTC
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?

Comment 8 Peter Schiffer 2017-05-31 14:01:11 UTC
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

Comment 9 Peter Schiffer 2018-02-21 15:47:42 UTC
New version of lsof including the patch from upstream is now available in rawhide: https://koji.fedoraproject.org/koji/buildinfo?buildID=1048147

Comment 10 Fedora End Of Life 2018-05-03 08:38:35 UTC
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.

Comment 11 Fedora End Of Life 2018-05-29 11:59:49 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.