libthr, libpthread problems

Michael Bretterklieber mbretter at
Thu Apr 29 08:49:55 PDT 2004


currently I'm testing Mpd-4 on -current and It ran into deadlock, 
therefore I changed the lib mapping via libmap.conf. When using libc_r 
everything is ok, when using libpthread a deadlock occurs under some 
circumstances, when using libthr, then:

elvis:/home/mbretter/mpd/src# ./mpd
Multi-link PPP for FreeBSD, by Archie L. Cobbs.
Based on iij-ppp, by Toshiharu OHNO.
The mutex recurse count cannot be less than zero
Abnormal termination, file: /usr/src/lib/libthr/thread/thr_mutex.c, 
line: 677
Abort trap (core dumped)

#0  0x282dd48b in thr_kill () from /lib/
(gdb) bt
#0  0x282dd48b in thr_kill () from /lib/
#1  0x28287e9f in _pthread_kill (pthread=0x808e000, sig=6)
     at /usr/src/lib/libthr/thread/thr_sig.c:94
#2  0x28287aab in _raise (sig=6)
     at /usr/src/lib/libthr/thread/thr_syscalls.c:282
#3  0x2833ff4f in abort () from /lib/
#4  0x2828a9bf in mutex_unlock_common (mutex=0x281460b0, add_reference=0)
     at /usr/src/lib/libthr/thread/thr_mutex.c:712
#5  0x2828a664 in __pthread_mutex_unlock (mutex=0x281460b0)
     at /usr/src/lib/libthr/thread/thr_mutex.c:587
#6  0x28127251 in typed_mem_realloc () from /usr/local/lib/
#7  0x281275b2 in typed_mem_strdup () from /usr/local/lib/
#8  0x28127672 in typed_mem_vasprintf () from /usr/local/lib/
#9  0x2812b4b1 in valog () from /usr/local/lib/
#10 0x0806b610 in vlogprintf (fmt=0x0, ap=0x0) at log.c:516
#11 0x0806af9e in LogPrintf (fmt=0x80824c0 "mpd: pid %lu, version %s")
     at log.c:273
#12 0x0806ba56 in Greetings () at main.c:249
#13 0x0806b71a in main (ac=-1077941372, av=0xbfbfecf0) at main.c:159
#14 0x0804b23e in _start ()

any ideas, is this a bug in the application itself or libthr specific?

If I'm using libpthread, then it works, but sometimes Mpd gets 
deadlocked (after terminating a thread and acquiring Mpd's internal
"giant mutex").

elvis:/home/mbretter/mpd/src# ps -p 7558 -H
  7558  p0  SL     0:00.12 ./mpd
  7558  p0  SL     0:00.12 ./mpd
  7558  p0  SL     0:00.12 ./mpd

and state of the process is "kserel".

When Using libc_r everything works fine.

I also tried to attach gdb to the running process (when Mpd was 
deadlocked), but this didn't worked, gdb als gets locked then.

The machine has installed a -current dated of yesterday, using a non-smp 

------------------------------- ----------------------------------
Michael Bretterklieber          -
A-Quadrat Automation GmbH       -
Tel: ++43-(0)3172-41679         - GSM: ++43-(0)699 12861847
------------------------------- ----------------------------------
"...the number of UNIX installations has grown to 10, with more 
expected..." - Dennis Ritchie and Ken Thompson, June 1972

More information about the freebsd-current mailing list