rndc halt -p behavior

Mark Andrews Mark_Andrews at isc.org
Thu Jan 22 00:20:53 UTC 2009


In message <1A345677-0C03-45A7-A1E1-AF364FE8752A at gronkulator.com>, Rich Goodson writes:
> Basically, I'm trying to use a shell script to replace the missing  
> 'restart' argument to rndc,  so I was looking for  some sort of return  
> value that tells me, "hey, your old named process is now gone, feel  
> free to start a new one".
>
> What doesn't seem to jibe to me with the behavior I see is this line:
> 
> > If -p is specified named's process id is returned. This allows an  
> > external process to determine when named had completed halting.
 
        pid=`rndc halt -p`
        case "$pid" in
        pid:*)
                pid=`expr "$pid" : "pid: \([0-9]*\)"`
                echo -n waiting for $pid to exit
                while kill -0 $pid 2> /dev/null ; do echo -n .; sleep 1; done
                echo . done.;
                ;;
        esac
 
> Whether named is still answering queries or just cleaning up its  
> allocated memory, the PID is returned BEFORE named is gone, as named  
> is still running for a good while after the PID is returned (I've seen  
> up to 15 or 20 seconds or so).  So, if I use this in a script,  
> assuming the behavior that seems to be implied in the documentation,  
> I'm going to be starting a new instance of named once the PID is  
> returned, so I'm going to end up with 2 concurrent named processes.
> 
> I understand that I probably seem like a pedantic pain in the ass, but  
> is this broken, or is the documentation wrong?  You seem to be saying  
> that rndc is behaving correctly, so I must therefore assume that the  
> documentation is wrong in this respect and use some sort of logic in  
> my script to tell me when named has gone *poof*.
> 
> Unless the documentation is using a different definition of the word  
> "halt" than I am, which is entirely possible.  I'm defining "halted"  
> in my head as the process is gone and no longer appears in a process  
> listing, whereas you may be defining "halted" as when named has  
> stopped answering queries and has released its hold on port 53.  If  
> this is the case, it might not be a big deal if there are two  
> concurrent named processes, as the new one is free to grab the port  
> and start answering queries while the old one simply cleans up after  
> itself, memory-wise.
> 
> -rich
> 
> On Jan 21, 2009, at 5:00 PM, Mark Andrews wrote:
> 
> >
> > In message <2971F259-4897-48F8-B418-2F759907596B at gronkulator.com>,  
> > Rich Goodson
> > writes:
> >> The behavior of 'rndc halt -p' appears to be different from the =20
> >> documentation.
> >>
> >> According to the BIND 9.4 ARM rndc section:
> >> halt [-p] Stop the server immediately. Recent changes made through  
> >> =20
> >> dynamic update or IXFR
> >> are not saved to the master =EF=AC=81les, but will be rolled  
> >> forward =
> >> from the =20
> >> journal =EF=AC=81les when the
> >> server is restarted. If -p is speci=EF=AC=81ed named=E2=80=99s  
> >> process =
> >> id is =20
> >> returned. This allows an external
> >> process to determine when named had completed halting.
> >>
> >> But the actual behavior seems to be that 'rndc halt -p' returns =20
> >> immediately with the PID of named, but a 'ps -ef' shows named still  
> >> =20
> >> running until it's done answering its unfinished recursive queries  
> >> (or =20=
> >>
>> whatever it's busy doing).
> >>
> >> Is rndc broken, or is the documentation wrong, or am I missing =20
> >> something?
> >>
> >> If it makes a difference, this is on a server that exclusively does  
> >> =20
> >> recursive resolution and does not serve any authoritative zones.
> >>
> >> -rich
> >
> > 	named is just freeing all memory that it has allocated.  If there
> > 	has been a memory leak this is when it will be detected.
> >
> > 	Mark
> > -- 
> > Mark Andrews, ISC
> > 1 Seymour St., Dundas Valley, NSW 2117, Australia
> > PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at isc.org
> >
> 
> 
> --Apple-Mail-20-871872810
> Content-Type: text/html;
> 	charset=US-ASCII
> Content-Transfer-Encoding: quoted-printable
> 
> <html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><div><div>Basically, I'm trying =
> to use a shell script to replace the missing 'restart' argument to rndc, =
>  so I was looking for  some sort of return value that tells =
> me, "hey, your old named process is now gone, feel free to start a new =
> one".</div><div><br></div><div>What doesn't seem to jibe to me with the =
> behavior I see is this line:</div><div><br></div><div></div><blockquote =
> type=3D"cite"><div>If -p is specified named's process id is returned. =
> This allows an external process to determine when named had completed =
> halting.</div></blockquote><div><br></div><div>Whether named is still =
> answering queries or just cleaning up its allocated memory, the PID is =
> returned BEFORE named is gone, as named is still running for a good =
> while after the PID is returned (I've seen up to 15 or 20 seconds or =
> so).  So, if I use this in a script, assuming the behavior that =
> seems to be implied in the documentation, I'm going to be starting a new =
> instance of named once the PID is returned, so I'm going to end up with =
> 2 concurrent named processes.</div><div><br></div><div>I understand that =
> I probably seem like a pedantic pain in the ass, but is this broken, or =
> is the documentation wrong?  You seem to be saying that rndc is =
> behaving correctly, so I must therefore assume that the documentation is =
> wrong in this respect and use some sort of logic in my script to tell me =
> when named has gone *poof*.</div><div><br></div><div>Unless the =
> documentation is using a different definition of the word "halt" than I =
> am, which is entirely possible.  I'm defining "halted" in my head =
> as the process is gone and no longer appears in a process listing, =
> whereas you may be defining "halted" as when named has stopped answering =
> queries and has released its hold on port 53.  If this is the case, =
> it might not be a big deal if there are two concurrent named processes, =
> as the new one is free to grab the port and start answering queries =
> while the old one simply cleans up after itself, =
> memory-wise.</div><div><br></div><div>-rich</div></div><div><div><span =
> class=3D"Apple-style-span" style=3D"font-family: -webkit-monospace; =
> font-size: 10px; "><div><br></div></span><div><div>On Jan 21, 2009, at =
> 5:00 PM, Mark Andrews wrote:</div><br =
> class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div><br>In =
> message <<a =
> href=3D"mailto:2971F259-4897-48F8-B418-2F759907596B at gronkulator.com">2971F=
> 259-4897-48F8-B418-2F759907596B at gronkulator.com</a>>, Rich Goodson<br> =
> writes:<br><blockquote type=3D"cite">The behavior of 'rndc halt -p' =
> appears to be different from the =3D20<br></blockquote><blockquote =
> type=3D"cite">documentation.<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><blockquote type=3D"cite">According to =
> the BIND 9.4 ARM rndc section:<br></blockquote><blockquote =
> type=3D"cite">halt [-p] Stop the server immediately. Recent changes made =
> through =3D20<br></blockquote><blockquote type=3D"cite">dynamic update =
> or IXFR<br></blockquote><blockquote type=3D"cite">are not saved to the =
> master =3DEF=3DAC=3D81les, but will be rolled forward =
> =3D<br></blockquote><blockquote type=3D"cite">from the =
> =3D20<br></blockquote><blockquote type=3D"cite">journal =3DEF=3DAC=3D81les=
>  when the<br></blockquote><blockquote type=3D"cite">server is restarted. =
> If -p is speci=3DEF=3DAC=3D81ed named=3DE2=3D80=3D99s process =
> =3D<br></blockquote><blockquote type=3D"cite">id is =
> =3D20<br></blockquote><blockquote type=3D"cite">returned. This allows an =
> external<br></blockquote><blockquote type=3D"cite">process to determine =
> when named had completed halting.<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><blockquote type=3D"cite">But the actual =
> behavior seems to be that 'rndc halt -p' returns =
> =3D20<br></blockquote><blockquote type=3D"cite">immediately with the PID =
> of named, but a 'ps -ef' shows named still =
> =3D20<br></blockquote><blockquote type=3D"cite">running until it's done =
> answering its unfinished recursive queries (or =
> =3D20=3D<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><blockquote type=3D"cite">whatever it's =
> busy doing).<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><blockquote type=3D"cite">Is rndc broken, =
> or is the documentation wrong, or am I missing =
> =3D20<br></blockquote><blockquote =
> type=3D"cite">something?<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><blockquote type=3D"cite">If it makes a =
> difference, this is on a server that exclusively does =
> =3D20<br></blockquote><blockquote type=3D"cite">recursive resolution and =
> does not serve any authoritative zones.<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><blockquote =
> type=3D"cite">-rich<br></blockquote><br><span class=3D"Apple-tab-span" =
> style=3D"white-space:pre">	</span>named is just freeing all memory =
> that it has allocated.  If there<br><span class=3D"Apple-tab-span" =
> style=3D"white-space:pre">	</span>has been a memory leak this is =
> when it will be detected.<br><br><span class=3D"Apple-tab-span" =
> style=3D"white-space:pre">	</span>Mark<br>-- <br>Mark Andrews, =
> ISC<br>1 Seymour St., Dundas Valley, NSW 2117, Australia<br>PHONE: +61 2 =
> 9871 4742 =
>             &n=
> bsp;   INTERNET: <a =
> href=3D"mailto:Mark_Andrews at isc.org">Mark_Andrews at isc.org</a><br><br></div=
> ></blockquote></div><br></div></div></body></html>=
> 
> --Apple-Mail-20-871872810--
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at isc.org



More information about the bind-users mailing list