tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: radiusd: Error detected by libpthread: Invalid mutex.

In article <kme4p5$mu1$>,
Christos Zoulas <> wrote:
>In article <>,
>Edgar Fuß  <> wrote:
>>> It is prolly a radiusd bug:
>>And I probably need some help here.
>>> $ PTHREAD_DIAGASSERT=a radiusd
>>> $ gdb radiusd radiusd.core
>>> (gdb) where
>>I don't get a core (with allow_core_dumps = yes in radiusd.conf).
>>I tried gdb with follow-fork-mode set to child and a breakpoint on
>>pthread__errorfunc, but I get
>>      /usr/src/external/gpl3/gdb/dist/gdb/infrun.c:3036: internal-error:
>>handle_inferior_event: Assertion `inf' failed.
>>      A problem internal to GDB has been detected,
>>      further debugging may prove unreliable.
>>So I'm having a pretty hard time finding out who is calling
>>with a non-initialized mutex.
>>This is on a pretty recent (few days old) 6 (i.e. 6.1_RC4).

Otoh, this seems to say that mutexes work across fork.

#include <sys/wait.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <err.h>
#include <errno.h>

main(int argc, char *argv[])
        pthread_mutex_t mt;
        int status;

        pthread_mutex_init(&mt, NULL);

        switch (fork()) {
        case -1:
                err(EXIT_FAILURE, "fork");
        case 0:
                if ((errno = pthread_mutex_lock(&mt)) == 0)
                        errx(EXIT_FAILURE, "no error from forked mutex");
                        err(EXIT_SUCCESS, "ok, expected error");
                if (wait(&status) == -1)
                        err(EXIT_FAILURE, "wait");
                return WEXITSTATUS(status);

Home | Main Index | Thread Index | Old Index