Closed Bug 184617 Opened 22 years ago Closed 22 years ago

nsDirEnumeratorUnix::~nsDirEnumeratorUnix calls pthread_mutex_destroy on a mutex that is still in use

Categories

(Core :: XPCOM, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: timeless, Assigned: drepper.fsp)

References

Details

see also Bug 49813 nsDirEnumeratorUnix not thread-safe

mozilla-cvs from yesterday, valgrind, qt port w/ fixes committed today.
starting up (mozilla -P foo http://www.mozilla.org)

Type Manifest File:
/home/timeless/obj-i686-pc-linux-gnu-qt/dist/bin/components/xpti.dat
==27465== pthread_mutex_destroy: mutex is still in use
==27465==    at 0x4057BB9C: pthread_error (vg_libpthread.c:275)
==27465==    by 0x4057CAC1: __pthread_mutex_destroy (vg_libpthread.c:952)
==27465==    by 0x406AF630: (within /lib/libc-2.2.5.so)
==27465==    by 0x40460527: nsDirEnumeratorUnix::~nsDirEnumeratorUnix(void)
(/mnt/hda3/temp/mozilla/xpcom/io/nsL
ocalFileUnix.cpp:130)
==27465==    by 0x4046071A: nsDirEnumeratorUnix::Release(void)
(/mnt/hda3/temp/mozilla/xpcom/io/nsLocalFileUnix.
cpp:133)
==27465==    by 0x805F77B: ??? (../../dist/include/xpcom/nsCOMPtr.h:490)
==27465==    by 0x404A216E:
xptiInterfaceInfoManager::BuildFileList(nsISupportsArray *, nsISupportsArray **) (/m
nt/hda3/temp/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp:373)
==27465==    by 0x404A7331:
xptiInterfaceInfoManager::AutoRegisterInterfaces(void) (/mnt/hda3/temp/mozilla/xpcom
/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp:1910)
==27465==    by 0x404A0A01:
xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef(void) (/mnt/hda3/temp/mozi
lla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp:94)
==27465==    by 0x404A8378: XPTI_GetInterfaceInfoManager
(/mnt/hda3/temp/mozilla/xpcom/reflect/xptinfo/src/xptiI
nterfaceInfoManager.cpp:2131)
==27465==    by 0x403FA58A: NS_InitXPCOM2
(/mnt/hda3/temp/mozilla/xpcom/build/nsXPComInit.cpp:595)
==27465==    by 0x8059B30: main
(/mnt/hda3/temp/mozilla/xpfe/bootstrap/nsAppRunner.cpp:1880)
==27465==    by 0x4062917D: __libc_start_main (in /lib/libc-2.2.5.so)
==27465==    by 0x8052EF1: (within
/home/timeless/obj-i686-pc-linux-gnu-qt/xpfe/bootstrap/mozilla-bin)
This is not a bug.  valgrind complains about the closedir() function in libc
which looks like this:

int
__closedir (DIR *dirp)
{
  int fd;

  if (dirp == NULL)
    {
      __set_errno (EINVAL);
      return -1;
    }

  __libc_lock_lock (dirp->lock);

  fd = dirp->fd;

  __libc_lock_fini (dirp->lock);

  free ((void *) dirp);

  return __close (fd);
}

Note that we lock the mutex and then destroy it.  In theory it would be better
to unlock the mutex or destroy it right away but since we control the mutex
implementation and know this is not causing problems it is not done.

I might change it in future glibc versions but here it can be safely ignored. 
valgrind should get an appropriate entry in the file defining ignorable errors.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
thanks
Status: RESOLVED → VERIFIED
Component: Networking: Cache → XPCOM
QA Contact: tever → scc
>valgrind should get an appropriate entry in the file defining ignorable errors.

note that it does have this entry, if the right file gets used (glibc-2.2.supp).
for this file to get used, a glibc of the right version must be used while
./configure'ing valgrind, or you must specify the file yourself.
You need to log in before you can comment on or make changes to this bug.