samba: nmbd stopping fails once?

Dan Nicholson dbn.lists at gmail.com
Fri Jul 20 07:10:41 PDT 2007


On 7/20/07, Jens Stroebel <drifter at bcsoft.de> wrote:
>
> I did that and indeed, something I consider wierd did show up.
>
> After starting:
> root at bb:/usr/src/rpm> /usr/sbin/nmbd -D
> root at bb:/usr/src/rpm> ps -ef |grep nmb
> root     26943     1  0 15:29 ?        00:00:00 /usr/sbin/nmbd -D
> root     26944 26943  0 15:29 ?        00:00:00 /usr/sbin/nmbd -D
>
> there are 2 nmd processes present.
> Now doing 'killproc /usr/sbin/nmbd' leaves a new one at it's failing exit:
> root at bb:/usr/src/rpm> ps -ef |grep nmb
> root     27127     1  0 15:31 ?        00:00:00 /usr/sbin/nmbd -D
>
> This process gets found at the end of killproc run and therefor the
> script exists with a failure.

Very strange. Somehow, nmbd gets respawned when you start killing it.
Is anything connected to this server? nmbd might respawn to maintain
that connection. Or possibly, the child daemon (26944) gets respawned
when its parent (26943) dies. This would then have pid 1 as its
parent.

Hmm, it's hard for me to see what's going on because I only ever get
one nmbd process. But when I kill the parent smbd process, the
children all die. What happens when you just kill the parent (26943)
directly? Do any nmbd processes remain?

Again, it might be helpful to run nmbd with debugging and save that
log. It might have clues about all the spawning.

> I've attached a log of the trace'd killproc call.

Out of curiosity, what version of the lfs-bootscripts are you using?
I've been fixing bugs in the functions over the past few months. I
changed killproc to be more consistent, but I don't know if that would
change anything here.

> + '[' -n '26944 26943' ']'
> + for pid in '${pidlist}'
> + kill -TERM 26944
> + case "${killsig}" in
> + local dtime=3
> + '[' 3 '!=' 0 ']'
> + kill -0 26944
> + sleep 1
> + dtime=2
> + '[' 2 '!=' 0 ']'
> + kill -0 26944
> + break
> + kill -0 26944
> + for pid in '${pidlist}'
> + kill -TERM 26943
> + case "${killsig}" in
> + local dtime=3
> + '[' 3 '!=' 0 ']'
> + kill -0 26943
> + sleep 1
> + dtime=2
> + '[' 2 '!=' 0 ']'
> + kill -0 26943
> + sleep 1
> + dtime=1
> + '[' 1 '!=' 0 ']'
> + kill -0 26943
> + sleep 1
> + dtime=0
> + '[' 0 '!=' 0 ']'
> + kill -0 26943
> + kill -KILL 26943

This is strange that it had to pull out -KILL for this pid. I suspect
that this is where the issue is.

> + pidlist=27127

And this is what causes it to fail. The script is assuming that it
shouldn't find any more pids after the killing process. You may be
able to "solve" the problem just by telling killproc to use the
pidfile. This is more correct anyway, since you want to kill the
parent daemon. Try changing the bootscript to this:

killproc -p /var/run/nmbd.pid /usr/sbin/nmbd

This would have the nice side effect that the child daemon (26944) is
not killed by kill, but rather the parent daemon (26943). I'd be
curious to know if the extra spawned daemon (27127) happens in this
case.

--
Dan



More information about the blfs-dev mailing list