Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 2004 17:49:49 +0200
From:      Michael Bretterklieber <mbretter@a-quadrat.at>
To:        current@FreeBSD.org
Subject:   libthr, libpthread problems
Message-ID:  <4091241D.7020501@a-quadrat.at>

next in thread | raw e-mail | index | archive | help
Hi,

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/libc.so.5
(gdb) bt
#0  0x282dd48b in thr_kill () from /lib/libc.so.5
#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/libc.so.5
#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/libpdel.so.0
#7  0x281275b2 in typed_mem_strdup () from /usr/local/lib/libpdel.so.0
#8  0x28127672 in typed_mem_vasprintf () from /usr/local/lib/libpdel.so.0
#9  0x2812b4b1 in valog () from /usr/local/lib/libpdel.so.0
#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
   PID  TT  STAT      TIME COMMAND
  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 
kernel.

bye,
-- 
------------------------------- ----------------------------------
Michael Bretterklieber          - http://www.bretterklieber.com
A-Quadrat Automation GmbH       - http://www.a-quadrat.at
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4091241D.7020501>