Subject: lib/22435: simple pthread apps experience Bus error on startup
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rtr@netbsd.org>
List: netbsd-bugs
Date: 08/11/2003 19:58:56
>Number:         22435
>Category:       lib
>Synopsis:       simple pthread apps experience Bus error on startup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 11 10:00:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Tyler R. Retzlaff
>Release:        NetBSD 1.6W
>Organization:
>Environment:
System: NetBSD silence 1.6W NetBSD 1.6W (silence) #0: Mon Aug 11 00:36:39 EST 2003 rtr@silence:/x/scratch/silence i386
Architecture: i386
Machine: i386
>Description:
I have been experiencing pthread apps fail with Bus error on startup, this is
the most common failure I experience and hasn't improved in a few weeks now.

>How-To-Repeat:

The following will eventually (but not always) re-produce the error.  If 
need I have a .core file and ktrace output just mail me if you wish me to
provide them.

#define _REENTRANT

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <pthread.h>

void *
message(void *arg)
{
        printf("thread success\n");
        return (void *) 0;
}

int
main(int argc, char **argv)
{
        int e;
        pthread_t tid;

        e = pthread_create(&tid, NULL, message, (void *) 0);


        if (e) {
                printf("failed create\n");
                return EXIT_FAILURE;
        }

        e = pthread_join(tid, NULL);

        if (e) {
                printf("failed join\n");
                return EXIT_FAILURE;
        }

        printf("success\n");

        return EXIT_SUCCESS;
}

>Fix:

None Provided
>Release-Note:
>Audit-Trail:
>Unformatted: