malloc/free deadlock bug

Gergely, KOVACS (VBuster) gkovacs at virusbuster.hu
Wed Feb 2 03:17:20 PST 2005


Dear FreeBSD people,

I have a multi threaded program (an Anti-Virus for Sendmail with Milter
API compiled with gcc 3.4.2). The threads are created by Sendmail's
libmilter, and the number of threads is limited to 100
(MaxDaemonChildren is set to 100 in sendmail.cf)

The hardware environment is a dual Xeon 3Ghz, and the OS is FreeBSD 5.3
with SMP enabled kernel.

The problem is that around in every 10th hour (100000 mail process) a
deadlock has been happened. According to gdb all threads are waiting in
malloc's, or free's mutex handler function:

#0  0x280b3c93 in pthread_mutexattr_init () from
/usr/lib/libpthread.so.1
#1  0x280b3be5 in pthread_mutexattr_init () from
/usr/lib/libpthread.so.1
#2  0x280b04bb in _pthread_mutex_trylock () from
/usr/lib/libpthread.so.1
#3  0x280b15e7 in pthread_mutex_lock () from /usr/lib/libpthread.so.1
#4  0x280a9b87 in _spinlock () from /usr/lib/libpthread.so.1
#5  0x2811c4a1 in ldexp () from /lib/libc.so.5
#6  0x2811c6d8 in malloc () from /lib/libc.so.5

or

#6  0x2811c704 in free () from /lib/libc.so.5


How can I fix this?


Best Regards,
Gergely Kovacs



More information about the freebsd-bugs mailing list