Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Apr 2004 10:05:54 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        freebsd-threads@freebsd.org
Subject:   missing error-checking in libpthread?
Message-ID:  <20040408150553.GA8182@dan.emsphone.com>

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

I'm seeing the following stack trace in a testsuite for a threaded
program.  At the time I generated the coredump, the process was in a
loop calling kse_release({0,1000000}) about 1.5 million times/sec,
every call returning EINVAL.

There are three calls to kse_release in thr_kern.c and one in
thr_sig.c, none of which check the returnvalue.  The call in thr_sig.c
and two of the calls in thr_kern.c even have code after kse_release()
as if they expected the call to return (which it shouldn't under normal
circumstances).  One call in thr_kern.c has a /* Never reach */ commect
after the call to kse_release, but again, no checks or calls to abort()
if it does happen.

(gdb) where
#0  0x282304db in kse_release () at {standard input}:15
#1  0x28228658 in _kse_lock_wait (lock=0x829b438, lu=0x83f2334)
    at /usr/src/lib/libpthread/thread/thr_kern.c:485
#2  0x282313c3 in _lock_acquire (lck=0x829b438, lu=0x83f2334, prio=22)
    at /usr/src/lib/libpthread/sys/lock.c:219
#3  0x28220499 in _pthread_sigmask (how=3, set=0x853531c, oset=0x0)
    at /usr/src/lib/libpthread/thread/thr_sigmask.c:64
#4  0x28220396 in _sigprocmask (how=3, set=0x853531c, oset=0x0)
    at /usr/src/lib/libpthread/thread/thr_sigprocmask.c:49
#5  0x282282e9 in _kse_single_thread (curthread=0x8535200)
    at /usr/src/lib/libpthread/thread/thr_kern.c:354
#6  0x2821d9bf in _fork () at /usr/src/lib/libpthread/thread/thr_fork.c:97
#7  0x080bf71e in f_create_process (args=1)
    at /usr/tmp/pike/src/signal_handler.c:3310
#8  0x08072e18 in low_mega_apply (type=APPLY_LOW, args=1, arg1=0x8309be0,
    arg2=0x6) at /usr/tmp/pike/src/apply_low.h:214
#9  0x08073e80 in mega_apply (type=APPLY_LOW, args=1, arg1=0x888d0c8, arg2=0x6)
    at /usr/tmp/pike/src/interpret.c:1981
#10 0x080d64a9 in call_pike_initializers (o=0x888d0c8, args=1)
    at /usr/tmp/pike/src/object.c:337
#11 0x080d6595 in debug_clone_object (p=0x830fd00, args=1)
    at /usr/tmp/pike/src/object.c:363
#12 0x08073963 in low_mega_apply (type=APPLY_SVALUE_STRICT, args=1,
    arg1=0x835cdc8, arg2=0x0) at /usr/tmp/pike/src/interpret.c:1718
#13 0x08070c14 in jump_opcode_F_APPLY (arg1=137428224)
    at /usr/tmp/pike/src/interpret_functions.h:1936
#14 0x0835c962 in ?? ()
#15 0x08073e9c in mega_apply (type=APPLY_STACK, args=1, arg1=0x0, arg2=0x0)
    at /usr/tmp/pike/src/interpret.c:1983
#16 0x08073fc0 in f_call_function (args=1)
    at /usr/tmp/pike/src/interpret.c:2054
#17 0x080fef2b in new_thread_func (data=0xbfbfdb04)
    at /usr/tmp/pike/src/threads.c:864
#18 0x2821e5c9 in thread_start (curthread=0x8535200,
    start_routine=0x80fed00 <new_thread_func>, arg=0xbfbfdb04)
    at /usr/src/lib/libpthread/thread/thr_create.c:353
#19 0x282cb0b3 in _ctx_start () at {standard input}:15
#20 0x00001000 in ?? ()
(gdb)


-- 
	Dan Nelson
	dnelson@allantgroup.com



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