Bug 114515 - pthread_join() error
Summary: pthread_join() error
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: glibc
Version: 2.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-01-29 00:02 UTC by Craig MacPherson
Modified: 2016-11-24 15:12 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-09-28 10:03:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
strace as requested. (8.44 KB, text/plain)
2004-02-06 00:15 UTC, Craig MacPherson
no flags Details
strace output as requested - first file was std io (56.59 KB, text/plain)
2004-02-06 00:19 UTC, Craig MacPherson
no flags Details

Description Craig MacPherson 2004-01-29 00:02:38 UTC
We're having a problem on Red Hat AS 2.1 - we're getting pthread_join
() error  
after 15 threads.  This is really simple test to reproduce problem.

Comment 1 Craig MacPherson 2004-01-29 00:04:04 UTC
 
Contact: 
cmacpher  or  (403) 296-4329. 
 
When I run the program code below the output is.... 
pthread_create() 0 
pthread_create() 1 
pthread_create() 2 
pthread_create() 3 
pthread_create() 4 
pthread_create() 5 
pthread_create() 6 
pthread_create() 7 
pthread_create() 8 
pthread_create() 9 
pthread_create() 10 
pthread_create() 11 
pthread_create() 12 
pthread_create() 13 
pthread_create() 14 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
<snip> same error message 85 more times... 
pthread_create() 0 
pthread_create() 1 
pthread_create() 2 
pthread_create() 3 
pthread_create() 4 
pthread_create() 5 
pthread_create() 6 
pthread_create() 7 
pthread_create() 8 
pthread_create() 9 
pthread_create() 10 
pthread_create() 11 
pthread_create() 12 
pthread_create() 13 
pthread_create() 14 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
pthread_create() error=Interrupted system call 
<snip> same error message 85 more times. 
 


Description of problem:
Cut and past the code below into a file thread100.c 
compile/link with command "cc -o thread100 -lpthread thread100.c" and 
run it  
as ./thread100 
 
------------- x ----------- 
#include <unistd.h> 
#include <string.h> 
#include <pthread.h> 
#include <errno.h> 
#include <stdio.h> 
#include <stdlib.h> 
 
void *sleeptime(void *); 
 
#define ORABM_TEST 100 
 
int main(argc, argv) 
int argc; 
char *argv[]; 
{ 
   thread_test(); 
} 
 
int thread_test() 
{ 
   int s; 
   pthread_t threads[1024]; 
   time_t now; 
   time_t start; 
   int secs; 
 
   time(&start); 
 
   secs=10; 
 
   for (s=0;s<ORABM_TEST;s++) 
   { 
      if (pthread_create(&threads[s], NULL, sleeptime, (void *)
&secs)) 
      { 
        printf("pthread_create() error=%s\n",strerror(errno)); 
      } 
      else 
      { 
        printf("pthread_create() %d\n",s); 
      } 
   } 
 
   for (s=0;s<ORABM_TEST;s++) 
   { 
      if (pthread_join(threads[s],NULL)) 
      { 
         printf("pthread_join() error=%s\n",strerror(errno)); 
      } 
      else 
      { 
        printf("pthread_join() %d\n",s); 
      } 
   } 
   time(&now); 
   printf("---start - %s",ctime(&start)); 
   printf("---end   - %s",ctime(&now)); 
} 
 
void *sleeptime(void *secs) 
{ 
   struct timespec req; 
   struct timespec rem; 
 
   req.tv_sec=*((int*)secs); 
   req.tv_nsec=0; 
   nanosleep(&req,&rem); 
   return(0); 
} 
 

Unfortunately under the RHEL Standard service level agreement we do 
not provide 
support for problems related to code development. Please see the 
following URL 
for details: 

     http://www.redhat.com/support/service/sla/rhel2_1.html

Since it appears you may have discovered a bug in RHEL AS 2.1 the 
appropriate 
place to report this issue would be: 

   http://bugzilla.redhat.com

Please let me know if you have any questions.

Regards,
Dave


Comment 2 Jakub Jelinek 2004-01-30 13:39:34 UTC
From what you wrote it is pthread_create which fails, not pthread_join.
But, I cannot reproduce this, works just fine here.
Can you perhaps strace it to see which syscall is failing and why?

Comment 3 Craig MacPherson 2004-02-06 00:15:33 UTC
Created attachment 97506 [details]
strace as requested.

Comment 4 Craig MacPherson 2004-02-06 00:19:33 UTC
Created attachment 97507 [details]
strace output as requested - first file was std io

Comment 5 Ulrich Drepper 2004-09-28 10:03:33 UTC
I cannot reproduce any problem.  Not with the current code (neither
LinuxThreads nor NPTL) and also not with an AS2.1 system.  I used:

kernel-2.4.9-e.49
glibc-2.2.4-32.17

I cannot offer any more help.  If your application depends on threads
it is in any case highly advised to use RHEL3 which features the new
thread library.  This library is much more POSIX compliant.

Comment 6 Craig MacPherson 2004-09-28 15:58:50 UTC
Thanks for the prompt attention to this matter.  Due to lack of 
support with RH Linux, we're looking at other LINUX alternatives.

Comment 7 Eric Paris 2004-10-28 21:23:09 UTC
this basically is the inability for you to create the stack for the
new pthread.  If you run

ulimit -s 1024 

in bash I was able to generate 2045 threads using your program without
running into any issues.

With the default bash stack size of 8192 I was only able to create 254
threads without a problem.

Comment 8 Eric Paris 2004-11-01 18:53:57 UTC
I also want to point out that pthread_create and pthread_join do not
set errorno and only have return calls to state they are out of
resources or they are past the max number.  See man pthread_create. 
So the "interrupted system call" is a bogus output.


Note You need to log in before you can comment on or make changes to this bug.