Method (2) is the way to go in your case. The parent process can create
the childs in a different contract and the parent is free to monitor
the contract events or call ct_ctl_abandon() to abandon them.

-- Renaud

-------- Original Message  --------
Subject: [smf-discuss] Applying SMF to processes that fork and kill children
From: Mac Mulder <mac.mul...@mirror-image.com>
To: smf-discuss at opensolaris.org
Date: Mon May 21 2007 23:56:47 GMT+0200 (CEST)

> Hi,
> I'm new to the implementation of SMF so hopefully this is not an RTFM type of 
> question ...
> 
> I'm trying to implement SMF for a process that forks and kills sub-processes 
> in its (hopefully long!) lifetime. I desire that SMF monitor the parent 
> process but disregard the children's coming's and going's (and potentially 
> signal activity). So, while failure of the parent would stimulate SMF to 
> re-start the service, failure of any children would be left to the parent to 
> attend to.
> 
> Now, after doing a bunch of searches here and elsewhere I became aware of an 
> example httpd config (httpd has similar behavior) which included the 
> following:
> 
>         < property_group name='startd' type='framework' >
>                < ! -- sub-process core dumps shouldn't restart session -- >
>                < propval name='ignore_error' type='astring' 
> value='core,signal' / >
>         < / property_group >
> 
> Initially I thought that this was the "magic bullet". However, this results 
> in *all* of the processes being ignored, not just the children of the parent. 
> IE Killing the parent, controlling process, elicits no response from SMF.
> 
> Now, if I go ahead and kill off the child as well, since the critical event 
> set includes 'hwerr' and 'empty', SMF will ultimately restart my parent app 
> as desired. However, unless all children are killed, SMF does not recognize 
> that the parent has moved on to a better computer :-)
> 
> I foresee a couple of suggestions:
> 
> 1) Create separate service entries for the children (possibly using ctrun)
> 
> The parent is a binary. It forks and changes behavior (again like httpd) So I 
> don't really have the option to break them out with separate method script 
> invocations etc.
> 
> 2) Have the parent process place the children in a separate contract from the 
> parent process (and the other related processes) using the API 
> libcontract(3LIB) and then ignore the contract.
> 
> This is what I suspect I need to do although I'm hoping that there is an RTFM 
> type XML solution here. I'd endure the embarrassment to save the development 
> time :-) I figure I could use the code from ctrun and ctwatch to learn from...
> 
> To be honest, if someone who is experienced enough to tell me definitively 
> that I need to actually code as (2) above to solve this would do so, that'd 
> be great. That is what I'm thinking is necessary, but I've got this nagging 
> fear I'm about to embark on a time wasting voyage to no-where and that there 
> is a much easier way to get the result I desire...
> 
> cheers
> Mac
>  
>  
> This message posted from opensolaris.org
> _______________________________________________
> smf-discuss mailing list
> smf-discuss at opensolaris.org


Reply via email to