Bug 1466278 - file descriptor leaks in fmt ?
file descriptor leaks in fmt ?
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: jose (Show other bugs)
7.4
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Nathaniel McCallum
Jiri Jaburek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-29 07:52 EDT by Cedric Buissart
Modified: 2017-11-14 13:21 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Cedric Buissart 2017-06-29 07:52:49 EDT
Description of problem:

Looking at the 2 fmt functions cmd_output() and cmd_foreach(), they don't seem to close their file descriptor, and references to these descriptors seem to be loss.

I am unsure if it is expected or not.


Version-Release number of selected component (if applicable): jose-8-1.el7.x86_64, but upstream doesn't seem to have a fix yet either.


How reproducible: 100%


Steps to Reproduce:

$ valgrind --track-fds=yes jose fmt -j- -O -o foo.file -o bar.file -f baz.txt -f qux.file <<< '{ "pin": "tang", "url": "http://localhost" }'
[...]
==26757== FILE DESCRIPTORS: 8 open at exit.
==26757== Open file descriptor 7: qux.file
==26757==    at 0x5D78790: __open_nocancel (syscall-template.S:81)
==26757==    by 0x5D08DDF: _IO_file_open (fileops.c:229)
==26757==    by 0x5D08DDF: _IO_file_fopen@@GLIBC_2.2.5 (fileops.c:339)
==26757==    by 0x5CFD4B3: __fopen_internal (iofopen.c:90)
==26757==    by 0x408D79: cmd_foreach (fmt.c:101)
==26757==    by 0x408D79: jcmd_fmt (fmt.c:665)
==26757==    by 0x402760: main (jose.c:500)
==26757== 
==26757== Open file descriptor 6: baz.txt
==26757==    at 0x5D78790: __open_nocancel (syscall-template.S:81)
==26757==    by 0x5D08DDF: _IO_file_open (fileops.c:229)
==26757==    by 0x5D08DDF: _IO_file_fopen@@GLIBC_2.2.5 (fileops.c:339)
==26757==    by 0x5CFD4B3: __fopen_internal (iofopen.c:90)
==26757==    by 0x408D79: cmd_foreach (fmt.c:101)
==26757==    by 0x408D79: jcmd_fmt (fmt.c:665)
==26757==    by 0x402760: main (jose.c:500)
==26757== 
==26757== Open file descriptor 5: bar.file
==26757==    at 0x5D78790: __open_nocancel (syscall-template.S:81)
==26757==    by 0x5D08DDF: _IO_file_open (fileops.c:229)
==26757==    by 0x5D08DDF: _IO_file_fopen@@GLIBC_2.2.5 (fileops.c:339)
==26757==    by 0x5CFD4B3: __fopen_internal (iofopen.c:90)
==26757==    by 0x408EE4: cmd_output (fmt.c:69)
==26757==    by 0x408EE4: jcmd_fmt (fmt.c:664)
==26757==    by 0x402760: main (jose.c:500)
==26757== 
==26757== Open file descriptor 4: foo.file
==26757==    at 0x5D78790: __open_nocancel (syscall-template.S:81)
==26757==    by 0x5D08DDF: _IO_file_open (fileops.c:229)
==26757==    by 0x5D08DDF: _IO_file_fopen@@GLIBC_2.2.5 (fileops.c:339)
==26757==    by 0x5CFD4B3: __fopen_internal (iofopen.c:90)
==26757==    by 0x408EE4: cmd_output (fmt.c:69)
==26757==    by 0x408EE4: jcmd_fmt (fmt.c:664)
==26757==    by 0x402760: main (jose.c:500)
[...]


Actual results: the fd 4 to 8 (foo, bar, baz & qux) are still opened at exit.


Expected results: jose to keep its fd table clean ☺
Comment 2 Nathaniel McCallum 2017-06-29 09:13:16 EDT
Fixed upstream: https://github.com/latchset/jose/commit/fd3b57b69077c155cdf9cb567cf0ec21c80b4c76
Comment 3 Nathaniel McCallum 2017-09-29 14:22:34 EDT
Fixed in jose-10-1.el7.

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