Bug 836345

Summary: Phtread objects leak in libgs.so (ghostscript library)
Product: [Fedora] Fedora Reporter: Philippe Vouters <Philippe.Vouters>
Component: ghostscriptAssignee: Tim Waugh <twaugh>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: pwouters, twaugh
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-04 16:18:05 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:
Attachments:
Description Flags
This zip file contains the Postscript file needed for the test program none

Description Philippe Vouters 2012-06-28 19:28:05 UTC
Created attachment 595113 [details]
This zip file contains the Postscript file needed for the test program

Description of problem:
ghostscript suffers from a pthread objects leak

Version-Release number of selected component (if applicable):
ghostscript-devel-9.05-1.fc17.i686
ghostscript-9.05-1.fc17.i686

How reproducible:
Always

Steps to Reproduce:
1. Get the program from http://vouters.dyndns.org/tima/Unix-Linux-OpenVMS-Ghostscript-Pthreads_objects_leak_when_posync.html as well as this attachment.
2. $ cc -O0 -g -o test test.c
3. gbd ./test
4. (gdb) break gsapi_new_instance
5. (gdb) break pthread_mutex_init
6. (gdb) break pthread_mutex_destroy
7. (gdb) run
  
Actual results:
pthread_mutex_init/pthread_mutex_destroy count mismatch. This proves a pthread mutex leak.

Expected results:
count matches.

Additional info:
I have not seen under gdb how to display pthread_mutex_t and pthread_mutex_cond_t types variables and watch out at their state and the thread waiters if any.

Comment 1 Philippe Vouters 2012-07-20 19:03:31 UTC
I have not seen using Ghostript 9.02 sources (ought to also apply to Ghostscript 9.05) a mean to get a gs_malloc_memory_t * pointer from a gs_malloc_block_t * pointer. The contrary is untrue.

Getting a gs_malloc_memory_t * pointer from a gs_malloc_block_t * pointer would have enabled to call gx_monitor_free in gs_heap_free_all (in the for (; bp != 0; bp = np) loop).

As far as observed and remembered from the program's execution under Fedora and Ghostscript V9.05, the application ought to only suffer from a "monitor" allocated pthread mutex leak.

Comment 2 Philippe Vouters 2012-07-20 19:43:36 UTC
Just a correction to my original bugzilla post. The correct cc command is:
$ cc -O0 -g -o test -lgs test.c

I re-executed the code under Fedora 17 (Ghostscript 9.05). I do confirm. The code does suffer from a "monitor" allocated pthread mutex leak (gx_monitor_alloc/gx_monitor_free unpaired). gx_semaphore_alloc/gx_semaphore_free calls are correctly paired.

Yours truly,
Philippe

Comment 3 Philippe Vouters 2012-09-04 17:08:17 UTC
This actual problem report which is very visible and much impacts the Ghostscript developer on OpenVMS platforms seems to competely pourrish. The actual fault is NOT on Red Hat shoulders but on Ghostscript developers who seem to do their best to protect themselves against any outside point of view regarding their work.

For Red Hat knowledge, I have been strictly unable to directly report the problem to Ghostscript developers. They forced me to report to Red Hat which seems to be also unempowered to correctly draw Ghostscript developers attention onto this full problem report in order to have it at last suitably addressed.

Comment 4 Fedora End Of Life 2013-07-04 04:07:48 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. 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 WONTFIX if it remains open with a Fedora 
'version' of '17'.

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 prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 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 to Fedora 17's end of life.

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 5 Fedora End Of Life 2013-08-01 12:45:21 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 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.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Paul Wouters 2013-08-16 16:31:15 UTC
This bug is still present in the f19 version

Comment 7 Tim Waugh 2014-06-04 16:18:05 UTC
http://bugs.ghostscript.com/show_bug.cgi?id=693593#c7 indicates that an instance is expected to last for the lifetime of the process.

However, I did fine one suspicious piece of code, which I've reported upstream.