View Single Post

   
  #1 (permalink)  
Old 01-17-2008, 06:01 AM
rajeshjangam@gmail.com
 
Posts: n/a
Default Application hangs

I have a single threaded application (daemon) which links to the
pthread library on HPUX 11.11.
The daemon listens on a socket and forks off a new process to serve
the incoming connection. It also does a waitpid for its children on
receipt of SIGCHLD.

It hangs after running for sometime (2-3 hours) in ksleep. This code
has been working fine on all other platforms:
Solaris, Linux, AIX.

Basically, the application code calls some non-thread safe functions.
To implement critical section around this, we use pthread_mutex_lock
and pthread_mutex_unlock.

Thought our application is single threaded, we have critical sections
since, this code is a part of a shared library (used by other
multithreaded applications)

Is this a problem with the pthread library implementation on HP 11.11?
Because, it is not reproducible on HP 11.31.

gdb does not show any useful information Here is the output of
tusc:

igvec(SIGCLD, 0x7f7f10a0,
0x7f7f10b0) .................................................. ..................................................
= 0
Received signal 18, SIGCLD, in setpgrp(), [caught], no siginfo
setpgrp(2) .................................................. .................................................. ............................
ERR#1 EPERM
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 14006
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f1650,
0x7f7f1660) .................................................. ..................................................
= 0
sigprocmask(SIG_BLOCK, 0x7f7f0c6c,
0x7f7f0c8c) .................................................. ..........................................
= 0
fork() .................................................. .................................................. ................................
= 14009
sigprocmask(SIG_SETMASK, 0x7f7f0c8c,
NULL) .................................................. ..............................................
= 0
close(5) .................................................. .................................................. ..............................
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f10a0,
0x7f7f10b0) .................................................. ..................................................
= 0
select(5, 0x7f7f0c00, NULL, NULL,
NULL) .................................................. .................................................
= 1
accept(4, 0x7f7f0d80,
0x7f7f0d7c) .................................................. .................................................. .....
= 5
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f10a0,
0x7f7f10b0) .................................................. ..................................................
= 0
setpgrp(2) .................................................. .................................................. ............................
ERR#1 EPERM
sigprocmask(SIG_BLOCK, 0x7f7f0c6c,
0x7f7f0c8c) .................................................. ..........................................
= 0
fork() .................................................. .................................................. ................................
= 14010
sigprocmask(SIG_SETMASK, 0x7f7f0c8c,
NULL) .................................................. ..............................................
= 0
close(5) .................................................. .................................................. ..............................
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f10a0,
0x7f7f10b0) .................................................. ..................................................
= 0
select(5, 0x7f7f0c00, NULL, NULL,
NULL) .................................................. .................................................
= 1
accept(4, 0x7f7f0d80,
0x7f7f0d7c) .................................................. .................................................. .....
= 5
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
Received signal 18, SIGCLD, in waitpid(), [caught], no siginfo
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 14005
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f1b10,
0x7f7f1b20) .................................................. ..................................................
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f10a0,
0x7f7f10b0) .................................................. ..................................................
= 0
setpgrp(2) .................................................. .................................................. ............................
ERR#1 EPERM
sigprocmask(SIG_BLOCK, 0x7f7f0c6c,
0x7f7f0c8c) .................................................. ..........................................
= 0
fork() .................................................. .................................................. ................................
= 14011
Received signal 18, SIGCLD, in sigprocmask(), [caught], no siginfo
sigprocmask(SIG_SETMASK, 0x7f7f0c8c,
NULL) .................................................. ..............................................
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 14007
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f1710,
0x7f7f1720) .................................................. ..................................................
= 0
close(5) .................................................. .................................................. ..............................
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
sigvec(SIGCLD, 0x7f7f10a0,
0x7f7f10b0) .................................................. ..................................................
= 0
select(5, 0x7f7f0c00, NULL, NULL,
NULL) .................................................. .................................................
= 1
accept(4, 0x7f7f0d80,
0x7f7f0d7c) .................................................. .................................................. .....
= 5
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
Received signal 18, SIGCLD, in user mode, [caught], no siginfo
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 14008
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
waitpid(-1, WIFEXITED(0),
WNOHANG) .................................................. .................................................. ....
= 0
ksleep(PTH_MUTEX_OBJECT, 0x7b031178, 0x7b031180,
NULL) .................................................. ..................................
[sleeping]
( Detaching from process 8625 ("bin/rscd") )





--------------------------------------------------------------------------------------------------------------------------------------------
Reading symbols from /usr/lib/libnss_dns.1...done.
Reading symbols from /usr/lib/libnsl.1...done.
Reading symbols from /usr/lib/libxti.2...done.
---Type <return> to continue, or q <return> to quit---
Reading symbols from /usr/lib/libnss_files.1...done.
0xc01feb68 in ?? () from /lib/libc.2
(gdb) thread apply all bt
(gdb) where
#0 0xc01feb68 in ?? () from /lib/libc.2
#1 0xc003da4c in ?? () from /lib/libpthread.1
#2 0xc0210668 in ?? () from /lib/libc.2
#3 0xc0207cc8 in ?? () from /lib/libc.2
#4 0xc0207c48 in ?? () from /lib/libc.2
(gdb) thread apply all bt
(gdb) bt
#0 0xc01feb68 in ?? () from /lib/libc.2
#1 0xc003da4c in ?? () from /lib/libpthread.1
#2 0xc0210668 in ?? () from /lib/libc.2
#3 0xc0207cc8 in ?? () from /lib/libc.2
#4 0xc0207c48 in ?? () from /lib/libc.2
(gdb) thread bt
Thread ID 0 not known. Use the "info threads" command to
see the IDs of currently known threads.
(gdb) thread apply all bt
(gdb) bt
#0 0xc01feb68 in ?? () from /lib/libc.2
#1 0xc003da4c in ?? () from /lib/libpthread.1
#2 0xc0210668 in ?? () from /lib/libc.2
#3 0xc0207cc8 in ?? () from /lib/libc.2
#4 0xc0207c48 in ?? () from /lib/libc.2
(gdb) where
#0 0xc01feb68 in ?? () from /lib/libc.2
#1 0xc003da4c in ?? () from /lib/libpthread.1
#2 0xc0210668 in ?? () from /lib/libc.2
#3 0xc0207cc8 in ?? () from /lib/libc.2
#4 0xc0207c48 in ?? () from /lib/libc.2
(gdb) help
List of classes of commands:

aliases -- Aliases of other commands

Reply With Quote