NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-amd64/46581: Continuous pthread_create may fail on amd64
>Number: 46581
>Category: port-amd64
>Synopsis: Continuous pthread_create may fail on amd64
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 11 03:55:00 +0000 2012
>Originator: Yui NARUSE
>Release: 6.99.7
>Organization:
>Environment:
NetBSD kelvena.airemix.net 6.99.7 NetBSD 6.99.7 (GENERIC) #2: Thu May 17
14:42:34 JST 2012
naruse%kelvena.airemix.net@localhost:/usr/obj/sys/arch/amd64/compile/GENERIC
amd64
>Description:
Below program fails on amd64 as following:
% cc -pthread thr.c&&./a.out
pthread_create: Resource temporarily unavailable
zsh: abort (core dumped) ./a.out
On the environment, ulimit -u is 160.
But it won't fail on i386.
It won't fail if sched_yield() is not commented out.
So it seems something is wrong.
#include <pthread.h>
#include <stdlib.h>
#define THREAD_COUNT 161
void *dummy(void *p) {
return NULL;
}
int main(void) {
int i;
pthread_t *threads = malloc(sizeof(pthread_t) * THREAD_COUNT);
for (i = 0; i < THREAD_COUNT; i++) {
if (pthread_create(&threads[i], NULL, dummy, &i)) {
perror("pthread_create");
abort();
}
//sched_yield();
}
return 0;
}
>How-To-Repeat:
>Fix:
Home |
Main Index |
Thread Index |
Old Index