Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jan 2003 17:03:16 -0500 (EST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        current@FreeBSD.org
Cc:        jmallett@FreeBSD.org
Subject:   pthread ^T problem on recent -CURRENT: death in libc_r mutex
Message-ID:  <Pine.NEB.3.96L.1030104170009.82416C-100000@fledge.watson.org>

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


Juli Mallett pointed me at the following reproduceable problem on my
-current notebook with userland/kernel dated Dec 29:

paprika:~/freebsd/test/pthread> ./test
1
2
1
2
1
2
load: 0.02  cmd: test 910 [running] 0.00u 0.01s 0% 824k
1
Bus error (core dumped)
paprika:~/freebsd/test/pthread> ./test
1
2
load: 0.23  cmd: test 914 [running] 0.00u 0.01s 0% 824k
1
Bus error (core dumped)

Hitting ^T to get status information seems to break output following the
first printf after the information display.  Here's the stack trace from
the test program from the first execution above: 

(gdb) bt
#0  0x2807a559 in _pthread_mutex_trylock () from /usr/lib/libc_r.so.5
#1  0x2807a71c in _pthread_mutex_lock () from /usr/lib/libc_r.so.5
#2  0x2813598f in flockfile () from /usr/lib/libc.so.5
#3  0x2812bfd0 in vfprintf () from /usr/lib/libc.so.5
#4  0x2811a552 in printf () from /usr/lib/libc.so.5
#5  0x0804860d in thread2 (arg=0x0) at test.c:22
#6  0x280732ce in _thread_start () from /usr/lib/libc_r.so.5

The program source is attached below.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Network Associates Laboratories


#include <pthread.h>
#include <stdio.h>
#include <unistd.h>

void *
thread1(void *arg)
{

        while (1) {
                sleep(2);
                printf("1\n");
        }
}

void *
thread2(void *arg)
{

        sleep(1);
        while (1) {
                sleep(2);
                printf("2\n");
        }
}

int
main(int argc, char *argv[]) {
        pthread_t t1, t2;
        int error;

        error = pthread_create(&t1, NULL, thread1, NULL);
        error = pthread_create(&t2, NULL, thread2, NULL);

        error = pthread_join(t1, NULL);
        error = pthread_join(t2, NULL);

        return (0);
}



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1030104170009.82416C-100000>