Bug 1753534
| Summary: | Too many open files in ImageMagick | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Remi Collet <fedora> |
| Component: | libpaper | Assignee: | Zdenek Dohnal <zdohnal> |
| Status: | CLOSED ERRATA | QA Contact: | qe-baseos-daemons |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.7 | CC: | omejzlik, thozza |
| Target Milestone: | rc | Keywords: | EasyFix, Patch, TestCaseProvided, Triaged |
| Target Release: | --- | Flags: | thozza:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libpaper-1.1.24-9.el7 | Doc Type: | No Doc Update |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-09-29 19:19:33 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1757052, 1780577 | ||
|
Description
Remi Collet
2019-09-19 08:46:08 UTC
Hello, thank you for reporting this problem! While I cannot reproduce/hit the limit on opened files I can definitely see the file /etc/papersize being opened multiple times while running the tests: ~~~ # lsof /etc/papersize | wc -l 591 # ~~~ This appears to be a bug with libpaper: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892490 https://github.com/ImageMagick/ImageMagick/issues/948 https://github.com/naota/libpaper/pull/1/commits/67a2005e8e7dcbd8b0872fabeb5badddfad19b21 [patch fixing this BZ] Libpaper was fixed in Fedora 28 (libpaper-file-leak.patch), but the fix didn't get to RHEL7, the current RHEL-7.7 libpaper-1.1.24-8.el7 code showing no fix for it: ~~~ 138 char* systempapername(void) { ... 143 FILE* ps; ... 225 } 226 227 paperdef = defaultpapername(); 228 paperstr = malloc((strlen(paperdef) + 1) * sizeof(char)); ~~~ vs: ~~~ f28]$ cat libpaper-file-leak.patch diff -up libpaper-1.1.24+nmu5/lib/paper.c.file-leak libpaper-1.1.24+nmu5/lib/paper.c --- libpaper-1.1.24+nmu5/lib/paper.c.file-leak 2018-03-09 16:21:01.028345956 +0100 +++ libpaper-1.1.24+nmu5/lib/paper.c 2018-03-09 16:40:57.824279357 +0100 @@ -140,7 +140,7 @@ char* systempapername(void) { char* paperstr; char* paperenv; const char* paperdef; - FILE* ps; + FILE* ps = NULL; struct stat statbuf; const struct paper* pp; int c; @@ -224,6 +224,9 @@ PAPERSIZEVAR, fall-back to the old behav } } + if (ps) + fclose(ps); + paperdef = defaultpapername(); paperstr = malloc((strlen(paperdef) + 1) * sizeof(char)); f28]$ ~~~ Reproducible using the below steps: ~~~ terminal1# yum install libgs libgs-devel @"Development Tools" terminal1# git clone https://github.com/ImageMagick/ImageMagick.git terminal1# cd ImageMagick/ terminal1# ./configure --with-gslib terminal1# make terminal1# make check ... PASS: tests/validate-composite.tap 1 PASS: tests/validate-convert.tap 1 terminal2# lsof /etc/papersize | wc -l 538 terminal2# ~~~ Can be seen from strace output clearly: ~~~ # strace -qfTttvys 4096 -e trace=open,close -o strace-make-check.txt make check # grep open\( strace-make-check.txt | grep papersize | wc -l 2932 # grep close\( strace-make-check.txt | grep papersize | wc -l 0 # ~~~ After applying the patch from Fedora 28, the problem goes away. Changing BZ component from ghostscript to libpaper. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (libpaper bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:3859 |