Renee Danson wrote:
> On Thu, Mar 26, 2009 at 04:17:01PM -0400, James Carlson wrote:
>   
>> Alan Maguire writes:
>>     
>>> in investigating a problem with a system() initiated
>>> execution of "pkill -9 dhcpagent" that we require
>>> as part of our shutdown procedure in the nwam daemon,
>>> it occurred to me that we could use process contract
>>> information to do a cleaner sigsend() to all the members
>>> in the contract (see http://blogs.sun.com/lianep/entry/how_does_kill_work).
>>> This would have the added benefit that it would kill any
>>> ENM scripts that were still running (as we spawn those
>>> also). Is there a reason not to pursue that approach perhaps?
>>>       
>> CR 6696321, I think.
>>     
>
> Hmm.  I think Alan's looking for a way to workaround a slightly
> different aspect of 6696321 that's been problematic for nwam: if
> nwamd is the thing that first launches dhcpagent (and it usually
> is), then dhcpagent winds up in nwam's contract.  So in order for
> the nwam service to shut down properly, dhcpagent must exit as
> well.  But nwamd needs to communicate with dhcpagent "on the way
> down", as it usually needs to release dhcp leases as part of its
> normal shutdown.  So, nwamd winds up needing to kill dhcpagent
> (this is why the nwam service stop method is an explicit pkill
> of nwamd, rather than the simpler :kill).
>
>   
Right. Sorry - I should have expanded on this a bit more.
I first took a look at what it would take to get dhcpagent
in a separate contract. The ideal scenario would be a
service conversion of course, but slightly less work
in the interim would have been to ctrun /sbin/dhcpagent
when it is invoked by libdhcpagent. Problem with this is
that ctrun is in /usr/bin, so not guaranteed to be available
early in boot
> Once 6696321 is fixed, that particular problem goes away: dhcpagent
> is no longer part of nwamd's contract, so nwamd can shutdown, asking
> dhcpagent to do work for it on the way down, and then dhcpagent can
> stick around and/or shut itself down according to its own rules.
> And since it's no longer in nwam's contract, the sigsend() that
> Alan is suggesting will no longer affect dhcpagent (but will still
> pick up those enm scripts he mentions).
>
> This seems like a good approach to me; am I missing something?
>
>   
One thing that occurred to me later - that SIGTERM will
also hit the daemon itself and the stop script (since these
are also part of the contract). So I think the right answer
would be to ensure that the last thing the net-nwam stop
method does before exit is to empty the rest of its contract via
smf_kill_contract(). Thanks!

Alan

Reply via email to