bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bad leaks file fd to child processes


From: Dale R. Worley
Subject: Re: Bad leaks file fd to child processes
Date: Sun, 27 Nov 2022 22:18:29 -0500

"凋叶棕" via Bug reports for the GNU Bourne Again SHell
<bug-bash@gnu.org> writes:
> I find that the file descriptor leaks when I execute the command pvs
> in bash 5.2, The abnormal scenario is similar to the bug which
> reported by
> http://lists.gnu.org/archive/html/bug-bash/2017-01/msg00026.html 
>  
> When I execute pvs in the terminal opened through xshell,it’s ok 
>  
> PV         VG      Fmt  Attr PSize    PFree 
> /dev/sda2  euleros lvm2 a--  <126.00g    0 

My memory is that older versions of pvs (which were called pvdisplay)
would always report that a descriptor was leaked.  It wasn't clear why
they reported it, since pvdisplay must have been noticing that *it*
wasn't closing the descriptor(s) properly, but since the process
terminated within seconds, the descriptors were closed by process
termination anyway.

This report seems likely to be the same thing, the descriptor leakage is
in the pvs process, and will be cleaned up by process termination.

A simple way to verify whether bash is leaking fd's is:

# # List all the fd's that Bash has open.
# ls -l /proc/$$/fd
total 0
lrwx------. 1 root root 64 Nov 27 22:12 0 -> /dev/pts/2
lrwx------. 1 root root 64 Nov 27 22:12 1 -> /dev/pts/2
lrwx------. 1 root root 64 Nov 27 22:12 2 -> /dev/pts/2
lrwx------. 1 root root 64 Nov 27 22:13 255 -> /dev/pts/2
lr-x------. 1 root root 64 Nov 27 22:12 3 -> /var/lib/sss/mc/passwd
lrwx------. 1 root root 64 Nov 27 22:13 4 -> 'socket:[1390116]'
# # Run some program.
# pvs
  PV         VG          Fmt  Attr PSize    PFree   
  /dev/sda3  Hobgoblin01 lvm2 a--  <300.00g  <40.00g
  /dev/sda5  Hobgoblin01 lvm2 a--  <630.02g <580.02g
  /dev/sdb3  Hobgoblin01 lvm2 a--    <1.82t    1.77t
# # Again list all the fd's that Bash has open.
# ls -l /proc/$$/fd
total 0
lrwx------. 1 root root 64 Nov 27 22:12 0 -> /dev/pts/2
lrwx------. 1 root root 64 Nov 27 22:12 1 -> /dev/pts/2
lrwx------. 1 root root 64 Nov 27 22:12 2 -> /dev/pts/2
lrwx------. 1 root root 64 Nov 27 22:13 255 -> /dev/pts/2
lr-x------. 1 root root 64 Nov 27 22:12 3 -> /var/lib/sss/mc/passwd
lrwx------. 1 root root 64 Nov 27 22:13 4 -> 'socket:[1390116]'
#

Dale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]