Subject: Re: PTHREAD_DIAGASSERT and pthread mutex locking errors
To: Tamas MEZEI <tamas@bazmag.hu>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-userlevel
Date: 01/10/2005 22:22:57
Tamas MEZEI <tamas@bazmag.hu> writes:
> "NeTraMet: Error detected by libpthread: Invalid mutex.
> Detected by file
> "/big/builds/ab/netbsd-2-0-RELEASE/src/lib/libpthread/pthread_mutex.c",
> line 194, function "pthread_mutex_lock_slow".
> See pthread(3) for information."
>
> I was googling around a bit and found to set PTHREAD_DIAGASSERT to AEL
> not to get any warnings.
>
> Anyway, I'd like to get some info about these pthread mutex errors if
> it's possible.
> - Usually what causes them (what pthread_mutex functions)?
It varies depending on which assertion fired. In this case, it usually
means that pthread_mutex_lock() was called on a pthread_mutex_t
variable that wan't initialized.
> - How to eliminate such crappy stuff from the source code (tips and
> hints are welcome, of course I know you can't fix any code blind)?
Tripping the error should cause a core dump, and you can look at the
backtrace in the core dump to see the pthread_mutex_lock() call that's
causing trouble.
- Nathan