Bug 53670 - pthreads implementation on 5.1-Release sparc64 not working
Summary: pthreads implementation on 5.1-Release sparc64 not working
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: sparc64 (show other bugs)
Version: 5.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-sparc64 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-24 10:40 UTC by Steven Haywood
Modified: 2005-02-28 13:59 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Haywood 2003-06-24 10:40:05 UTC
Code that uses pthreads hangs (mysql, python etc)

Fix: 

Unknown
How-To-Repeat: 
-bash-2.05b$ cat conftest.c
##########################################
#include <pthread.h>

void* routine(void* p){return NULL;}

int main(){
  pthread_t p;
  if(pthread_create(&p,NULL,routine,NULL)!=0)
    return 1;
  (void)pthread_detach(p);
  return 0;
}
###########################################
-bash-2.05b$ gcc -o test -lc_r conftest.c
-bash-2.05b$ truss ./test
mmap(0x0,7056,0x3,0x1000,-1,0x0)                 = 1075978240 (0x40222000)
munmap(0x40222000,0x1b90)                        = 0 (0x0)
__sysctl(0x7fdfffff4f0,0x2,0x40323110,0x7fdfffff4e8,0x0,0x0) = 0 (0x0)
mmap(0x0,32768,0x3,0x1002,-1,0x0)                = 1075978240 (0x40222000)
geteuid()                                        = 1002 (0x3ea)
getuid()                                         = 1002 (0x3ea)
getegid()                                        = 1001 (0x3e9)
getgid()                                         = 1001 (0x3e9)
mmap(0x0,40960,0x3,0x1002,-1,0x0)                = 1076011008 (0x4022a000)
open("/var/run/ld-elf.so.hints",0x0,010010540070) = 3 (0x3)
read(0x3,0x7fdfffff780,0x80)                     = 128 (0x80)
lseek(3,0x80,-1)                                 = 128 (0x80)
read(0x3,0x4022e000,0x57)                        = 87 (0x57)
close(3)                                         = 0 (0x0)
access("/usr/lib/libc_r.so.5",0)                 = 0 (0x0)
open("/usr/lib/libc_r.so.5",0x0,07)              = 3 (0x3)
fstat(3,0x7fdfffff840)                           = 0 (0x0)
read(0x3,0x7fdffffd780,0x2000)                   = 8192 (0x2000)
mmap(0x0,1220608,0x5,0x20002,3,0x0)              = 1077043200 (0x40326000)
mprotect(0x40342000,0x2000,0x7)                  = 0 (0x0)
mprotect(0x40342000,0x2000,0x5)                  = 0 (0x0)
mmap(0x40442000,16384,0x7,0x12,3,0x0)            = 1078206464 (0x40442000)
mmap(0x40446000,40960,0x7,0x1012,-1,0x0)         = 1078222848 (0x40446000)
close(3)                                         = 0 (0x0)
access("/usr/lib/libc.so.5",0)                   = 0 (0x0)
open("/usr/lib/libc.so.5",0x0,0137)              = 3 (0x3)
fstat(3,0x7fdfffff840)                           = 0 (0x0)
read(0x3,0x7fdffffd780,0x2000)                   = 8192 (0x2000)
mmap(0x0,2154496,0x5,0x20002,3,0x0)              = 1078263808 (0x40450000)
mprotect(0x40538000,0x2000,0x7)                  = 0 (0x0)
mprotect(0x40538000,0x2000,0x5)                  = 0 (0x0)
mmap(0x40638000,73728,0x7,0x12,3,0x0)            = 1080262656 (0x40638000)
mmap(0x4064a000,81920,0x7,0x1012,-1,0x0)         = 1080336384 (0x4064a000)
close(3)                                         = 0 (0x0)
mmap(0x0,304,0x3,0x1000,-1,0x0)                  = 1076051968 (0x40234000)
munmap(0x40234000,0x130)                         = 0 (0x0)
mmap(0x0,9456,0x3,0x1000,-1,0x0)                 = 1076051968 (0x40234000)
munmap(0x40234000,0x24f0)                        = 0 (0x0)
mmap(0x0,43072,0x3,0x1000,-1,0x0)                = 1076051968 (0x40234000)
munmap(0x40234000,0xa840)                        = 0 (0x0)
__sysctl(0x7fdfffff550,0x2,0x4065b218,0x7fdfffff548,0x0,0x0) = 0 (0x0)
getpid()                                         = 33200 (0x81b0)
fcntl(0x0,0x3,0x0)                               = 2 (0x2)
fcntl(0x1,0x3,0x0)                               = 2 (0x2)
fcntl(0x2,0x3,0x0)                               = 2 (0x2)
pipe()                                           = 3 (0x3)
fcntl(0x3,0x3,0x0)                               = 2 (0x2)
fcntl(0x3,0x4,0x6)                               = 0 (0x0)
fcntl(0x4,0x3,0x0)                               = 2 (0x2)
fcntl(0x4,0x4,0x6)                               = 0 (0x0)
readlink("/etc/malloc.conf",0x7fdfffff380,63)    ERR#2 'No such file or directory'
issetugid()                                      = 0 (0x0)
getuid()                                         = 1002 (0x3ea)
getgid()                                         = 1001 (0x3e9)
mmap(0x0,8192,0x3,0x1002,-1,0x0)                 = 1076051968 (0x40234000)
break(0x200d68)                                  = 0 (0x0)
break(0x200d68)                                  = 0 (0x0)
break(0x204000)                                  = 0 (0x0)
break(0x204000)                                  = 0 (0x0)
break(0x206000)                                  = 0 (0x0)
break(0x206000)                                  = 0 (0x0)
break(0x208000)                                  = 0 (0x0)
break(0x208000)                                  = 0 (0x0)
break(0x20a000)                                  = 0 (0x0)
break(0x20a000)                                  = 0 (0x0)
break(0x20c000)                                  = 0 (0x0)
__sysctl(0x7fdfffff670,0x2,0x40443370,0x7fdfffff628,0x0,0x0) = 0 (0x0)
mmap(0x7fdffefe000,8192,0x0,0x1000,-1,0x0)       = -1056768 (0xffefe000)
break(0x20c000)                                  = 0 (0x0)
break(0x20e000)                                  = 0 (0x0)
gettimeofday(0x40443390,0x0)                     = 0 (0x0)
sysarch(0x2,0x4063e100)                          = 0 (0x0)
sigaction(SIGHUP,0x0,0x40449420)                 = 0 (0x0)
sigaction(SIGINT,0x0,0x40449440)                 = 0 (0x0)
sigaction(SIGQUIT,0x0,0x40449460)                = 0 (0x0)
sigaction(SIGILL,0x0,0x40449480)                 = 0 (0x0)
sigaction(SIGTRAP,0x0,0x404494a0)                = 0 (0x0)
sigaction(SIGABRT,0x0,0x404494c0)                = 0 (0x0)
sigaction(SIGEMT,0x0,0x404494e0)                 = 0 (0x0)
sigaction(SIGFPE,0x0,0x40449500)                 = 0 (0x0)
sigaction(SIGBUS,0x0,0x40449540)                 = 0 (0x0)
sigaction(SIGSEGV,0x0,0x40449560)                = 0 (0x0)
sigaction(SIGSYS,0x0,0x40449580)                 = 0 (0x0)
sigaction(SIGPIPE,0x0,0x404495a0)                = 0 (0x0)
sigaction(SIGALRM,0x0,0x404495c0)                = 0 (0x0)
sigaction(SIGTERM,0x0,0x404495e0)                = 0 (0x0)
sigaction(SIGURG,0x0,0x40449600)                 = 0 (0x0)
sigaction(SIGTSTP,0x0,0x40449640)                = 0 (0x0)
sigaction(SIGCONT,0x0,0x40449660)                = 0 (0x0)
sigaction(SIGCHLD,0x0,0x40449680)                = 0 (0x0)
sigaction(SIGTTIN,0x0,0x404496a0)                = 0 (0x0)
sigaction(SIGTTOU,0x0,0x404496c0)                = 0 (0x0)
sigaction(SIGIO,0x0,0x404496e0)                  = 0 (0x0)
sigaction(SIGXCPU,0x0,0x40449700)                = 0 (0x0)
sigaction(SIGXFSZ,0x0,0x40449720)                = 0 (0x0)
sigaction(SIGVTALRM,0x0,0x40449740)              = 0 (0x0)
sigaction(SIGPROF,0x0,0x40449760)                = 0 (0x0)
sigaction(SIGWINCH,0x0,0x40449780)               = 0 (0x0)
sigaction(SIGINFO,0x0,0x404497a0)                = 0 (0x0)
sigaction(SIGUSR1,0x0,0x404497c0)                = 0 (0x0)
sigaction(SIGUSR2,0x0,0x404497e0)                = 0 (0x0)
sigaction(SIGPROF,0x7fdfffff630,0x0)             = 0 (0x0)
sigaction(SIGINFO,0x7fdfffff630,0x0)             = 0 (0x0)
sigaction(SIGCHLD,0x7fdfffff630,0x0)             = 0 (0x0)
sigprocmask(0x3,0x0,0x40443418)                  = 0 (0x0)
__sysctl(0x7fdfffff670,0x2,0x7fdfffff650,0x7fdfffff628,0x0,0x0) = 0 (0x0)
getdtablesize()                                  = 3405 (0xd4d)
break(0x20e000)                                  = 0 (0x0)
break(0x216000)                                  = 0 (0x0)
break(0x216000)                                  = 0 (0x0)
break(0x21e000)                                  = 0 (0x0)
break(0x21e000)                                  = 0 (0x0)
break(0x220000)                                  = 0 (0x0)
fcntl(0x0,0x4,0x6)                               = 0 (0x0)
fcntl(0x1,0x4,0x6)                               = 0 (0x0)
fcntl(0x2,0x4,0x6)                               = 0 (0x0)
sigprocmask(0x1,0x40322f40,0x7fdfffff8b0)        = 0 (0x0)
sigprocmask(0x3,0x40322f50,0x0)                  = 0 (0x0)
sysarch(0x1,0x40639390)                          = 0 (0x0)
mmap(0x7fdffeee000,65536,0x3,0x400,-1,0x0)       = -1122304 (0xffeee000)
setitimer(0x2,0x7fdfffff930,0x0)                 = 0 (0x0)
SIGNAL 27
SIGNAL 27
gettimeofday(0x40443390,0x0)                     = 0 (0x0)
sigprocmask(0x3,0x40443418,0x0)                  = 0 (0x0)
sigreturn(0x7fdfffff250)                         = 1076043776 (0x40232000)
poll(0x216000,0x0,0x0)                           = 0 (0x0)


Nothing else happens until I Ctrl-C it. Note that in this case I waited about 3 minutes.
^CSIGNAL 2
poll(0x216000,0x1,0xffffffffffffffff)            ERR#4 'Interrupted system call'
SIGNAL 2
SIGNAL 2
process exit, rval = 2
Comment 1 t.moestl 2003-06-24 16:50:22 UTC
On Tue, 2003/06/24 at 10:34:17 +0100, Steven Haywood wrote:
> >Description:
> Code that uses pthreads hangs (mysql, python etc)
> 	
> >How-To-Repeat:
> 
> -bash-2.05b$ cat conftest.c
> ##########################################
> #include <pthread.h>
> 
> void* routine(void* p){return NULL;}
> 
> int main(){
>   pthread_t p;
>   if(pthread_create(&p,NULL,routine,NULL)!=0)
>     return 1;
>   (void)pthread_detach(p);
>   return 0;
> }
> ###########################################
> -bash-2.05b$ gcc -o test -lc_r conftest.c
> -bash-2.05b$ truss ./test
> mmap(0x0,7056,0x3,0x1000,-1,0x0)                 = 1075978240 (0x40222000)
> munmap(0x40222000,0x1b90)                        = 0 (0x0)
> __sysctl(0x7fdfffff4f0,0x2,0x40323110,0x7fdfffff4e8,0x0,0x0) = 0 (0x0)
> [...]
> setitimer(0x2,0x7fdfffff930,0x0)                 = 0 (0x0)
> SIGNAL 27
> SIGNAL 27
> gettimeofday(0x40443390,0x0)                     = 0 (0x0)
> sigprocmask(0x3,0x40443418,0x0)                  = 0 (0x0)
> sigreturn(0x7fdfffff250)                         = 1076043776 (0x40232000)
> poll(0x216000,0x0,0x0)                           = 0 (0x0)
> 
> 
> Nothing else happens until I Ctrl-C it. Note that in this case I waited about 3 minutes.
> ^CSIGNAL 2
> poll(0x216000,0x1,0xffffffffffffffff)            ERR#4 'Interrupted system call'
> SIGNAL 2
> SIGNAL 2
> process exit, rval = 2

I cannot reproduce this. When the process is hanging, does it loop
(using all available CPU), or is it sleeping (and if it is, in which
state)? Can you please also try pressing ^T? This should make the
process generate a state dump in /tmp/uthread.dump.<pid>.<serial>,
which should be interesting. 

	- Thomas

-- 
Thomas Moestl <t.moestl@tu-bs.de>	http://www.tu-bs.de/~y0015675/
              <tmm@FreeBSD.org>		http://people.FreeBSD.org/~tmm/
PGP fingerprint: 1C97 A604 2BD0 E492 51D0  9C0F 1FE6 4F1D 419C 776C
Comment 2 Marius Strobl freebsd_committer freebsd_triage 2005-02-28 13:57:56 UTC
State Changed
From-To: open->closed


Close, not reproducible, no reply from originator after feedback was provided.