[ntp:questions] "ntpdate" hanging !!
Srikanth K
srikanth.k at hp.com
Mon Mar 7 15:01:36 UTC 2005
Hello
Actually i am running a big application in hp-ux 11.11 and the program
which i sent in my previous mail is just a simulation of the problem in
my application. Actually, the application tries to block SIGALRM signal
and run "ntpdate" binary by calling "system" library call. In the actual
scenario, the parent program blocks the SIGALRM signal and the "system"
function calls fork/vfork and execs the "ntpdate" binary.
Eventually, the child process ( in this case: the ntpdate program ) has
SIGALRM set in its signal mask. Therefore, SIGALRM is blocked for the
ntpdate program also.
The following is the sytem call trace for the sample program:
execve("./a", 0x79ff0558, 0x79ff0560)
.........................................................................
= 0 [32-bit]
utssys(0x79ff2640, 0, 0)
......................................................................................
= 0
open("/usr/lib/dld.sl", O_RDONLY, 017177602530)
............................................................... = 3
read(3, "02\v010e0512@ \0\0\0\0\0\0\0\0\0".., 128)
............................................................ = 128
lseek(3, 128, SEEK_SET)
.......................................................................................
= 128
read(3, "10\0\004\0\0\0( \001a194\0\0\0\0".., 48)
............................................................. = 48
mmap(NULL, 106900, PROT_READ|PROT_EXEC, MAP_SHARED|MAP_SHLIB, 3, 0x7000)
...................................... = 0xc0001000
mmap(NULL, 13000, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_SHLIB,
3, 0x22000) .......................... = 0x79fec000
close(3)
......................................................................................................
= 0
getuid()
......................................................................................................
= 0 (0)
getuid()
......................................................................................................
= 0 (0)
getgid()
......................................................................................................
= 3 (3)
getgid()
......................................................................................................
= 3 (3)
mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS, -1, NULL) ......................... = 0x79fea000
sysconf(_SC_CPU_VERSION)
......................................................................................
= 0x210
open("/opt/graphics/OpenGL/lib/libogltls.sl", O_RDONLY, 0)
.................................................... ERR#2 ENOENT
open("/usr/lib/libc.2", O_RDONLY, 0)
..........................................................................
= 3
fstat(3, 0x79ff2f00)
..........................................................................................
= 0
read(3, "0210010e0512@ \0\0\0\0\0\0\0\0\0".., 128)
............................................................ = 128
lseek(3, 128, SEEK_SET)
.......................................................................................
= 128
read(3, "10\0\004\0\0\0( \01518fc\0\010\0".., 48)
............................................................. = 48
read(3, "80\0\0\v\0\0\004\0\0\0\0", 12)
....................................................................... = 12
lseek(3, 446464, SEEK_SET)
....................................................................................
= 446464
read(3, "058cy 10\0\0\a90\0\0N , \0\0\002".., 112)
............................................................ = 112
mmap(NULL, 1384448, PROT_READ|PROT_EXEC, MAP_SHARED|MAP_SHLIB, 3,
0x6d000) .................................... = 0xc001c000
mmap(NULL, 45056, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_SHLIB, -1, NULL) .............. = 0x79fdf000
mmap(0x79fd7000, 32768, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_SHLIB, 3, 0x1bf000) ......... = 0x79fd7000
mmap(NULL, 16384, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS, -1, NULL) ........................ = 0x79fd3000
close(3)
......................................................................................................
= 0
open("/usr/lib/libdld.2", O_RDONLY, 0)
........................................................................ = 3
fstat(3, 0x79ff3000)
..........................................................................................
= 0
read(3, "02\v010e0512@ \0\0\0\0\0\0\0\0\0".., 128)
............................................................ = 128
lseek(3, 128, SEEK_SET)
.......................................................................................
= 128
read(3, "10\0\004\0\0\0( \0\0# 4 \0\010\0".., 48)
............................................................. = 48
read(3, "80\0\0\v\0\0\004\0\0\0\0", 12)
....................................................................... = 12
lseek(3, 8192, SEEK_SET)
......................................................................................
= 8192
read(3, "058cy 10\0\0\0\f\0\00198\0\0\001".., 112)
............................................................ = 112
mmap(NULL, 12288, PROT_READ|PROT_EXEC, MAP_SHARED|MAP_SHLIB, 3, 0x2000)
....................................... = 0xc016e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_SHLIB,
3, 0x5000) ............................ = 0x79fd2000
close(3)
......................................................................................................
= 0
open("/usr/lib/libc.2", O_RDONLY, 0)
..........................................................................
= 3
fstat(3, 0x79ff3100)
..........................................................................................
= 0
read(3, "0210010e0512@ \0\0\0\0\0\0\0\0\0".., 128)
............................................................ = 128
lseek(3, 128, SEEK_SET)
.......................................................................................
= 128
read(3, "10\0\004\0\0\0( \01518fc\0\010\0".., 48)
............................................................. = 48
read(3, "80\0\0\v\0\0\004\0\0\0\0", 12)
....................................................................... = 12
lseek(3, 446464, SEEK_SET)
....................................................................................
= 446464
read(3, "058cy 10\0\0\a90\0\0N , \0\0\002".., 112)
............................................................ = 112
mmap(NULL, 1384448, PROT_READ|PROT_EXEC, MAP_SHARED|MAP_SHLIB, 3,
0x6d000) .................................... ERR#12 ENOMEMclose(3)
......................................................................................................
= 0
mmap(NULL, 80, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS, -1, NULL) ........................... =
0x79fd1000
sigsetreturn(0x79fd4fee, 0x6211988, 1392)
..................................................................... = 0
sigblock(NULL)
................................................................................................
= 0
sigblock(0x2000)
..............................................................................................
= 0
sigsetreturn(0x79fd4fee, 0x6211988, 1392)
..................................................................... = 0
sigaction(SIGINT, 0x79ff0728, 0x79ff0750)
..................................................................... = 0
sigaction(SIGQUIT, 0x79ff0728, 0x79ff0778)
.................................................................... = 0
sigaction(SIGCLD, 0x79ff0728, 0x79ff07a0)
..................................................................... = 0
sigprocmask(SIG_BLOCK, 0x79ff072c, 0x79ff07c8)
................................................................ = 0
vfork()
.......................................................................................................
= 20903
7 Mar 19:48:13 ntpdate[20903]: signal_no_reset: signal 14 had flags 4
waitpid(20902, 0x79ff07ec, 0)
.................................................................................
[sleeping]
Following is the system call trace of the vforked child ( i.e. the
ntpdate process running with pid 20903) process:
( Attached to process 20903 ("/usr/sbin/ntp4/ntpdate -q clocksrv")
[32-bit] )
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
[20903] poll(0x40006388, 2, 60000)
............................................................................
= 0
[20903] poll(0x40006388, 2, 60000)
............................................................................
[sleeping]
Why does ntpdate behave like this ?
Is this the normal ( expected ) behaviour of ntpdate ( when SIGALRM is
blocked )
Thanks in Advance,
-Srikanth K.
mayer at gis.net wrote:
>----- Original Message Follows -----
>
>
>>Hello ,
>>
>>I notice a hang when i run the below mentioned program in a hp-ux
>>11.11 machine. The "ntpdate" binary which i am using in the program
>>is taken from "ntp-stable-4.2.0a-20040617" of the open ntp source.
>>
>>/* program starts here */
>>#include <signal.h>
>>#include <unistd.h>
>>
>>main()
>>{
>>
>>long oldmask, newmask;
>>
>>oldmask = sigblock(0);
>>sigblock(sigmask(SIGALRM));
>>
>>system("/usr/sbin/ntpdate -q <timeserver-ip>");
>>
>>sigsetmask(oldmask);
>>
>>}
>>/* program ends here */
>>
>>
>>Is it a bug in "ntpdate" binary? If so, is there any fix available for
>>it?
>>
>>
>
>No idea. Where is it hanging? Have you tried this outside your program?
>What's the purpose of the program? Have you run ntpdate under the
>debugger?
>
>Danny
>
>
>
>>Thanks in Advance,
>>-Srikanth K.
>>
>>_______________________________________________
>>questions mailing list
>>questions at lists.ntp.isc.org
>>https://lists.ntp.isc.org/mailman/listinfo/questions
>>
>>
More information about the questions
mailing list