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 <>,
Edgar Fuß  <> wrote:
>> It is prolly a radiusd bug:
>Maybe yes. See below.
>> $ gdb radiusd radiusd.core
>Unfortunately, this (with allow_core_dumps=yes in radiusd.conf) doesn't give
>me a core dump.
>The problem seems to be that radiusd sets up mutexes (pthread_mutex_init)
>while reading the config file. It reads the config file before fork()ing
>in order to daemonize. In fact, running it with -f and then manually
>backgrounding it makes the problem disappear.
>Also, moving the config-file reading code below the fork() also helps.
>Before reporting a bug to the FreeRADIUS people: It looks weird to me to
>create a mutex, then fork and use the mutex in the child process. However,
>I'm unsure whether this is really illegal (I can't find anything saying so
>besides the sheer existance of pthread_atfork(), which radiusd doesn't call)
>or a problem with NetBSD's implementation.
>Any pthread experts to help me?

It is implementation dependend; for portability pthread_mutex_init() should
be done in the child process and not cross a fork. Eg:

Please file a PR to add a note in our man pages.


Home | Main Index | Thread Index | Old Index