Bug 114515 - pthread_join() error
pthread_join() error
Status: CLOSED WORKSFORME
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: glibc (Show other bugs)
2.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-28 19:02 EST by Craig MacPherson
Modified: 2016-11-24 10:12 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-09-28 06:03:33 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Craig MacPherson 2004-01-28 19:02:38 EST
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-28 19:04:04 EST
 
Contact: 
cmacpher@petro-canada.ca  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 08:39:34 EST
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-05 19:15:33 EST
Created attachment 97506 [details]
strace as requested.
Comment 4 Craig MacPherson 2004-02-05 19:19:33 EST
Created attachment 97507 [details]
strace output as requested - first file was std io
Comment 5 Ulrich Drepper 2004-09-28 06:03:33 EDT
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 11:58:50 EDT
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 17:23:09 EDT
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 13:53:57 EST
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.