You might want to add the following to main() in gmond.c and try it out

apr_signal(SIGTERM, sig_handler);

Try adding this with the other apr_signal() calls in main().  This should 
instruct SIGTERM to gracefully shutdown in the same way that SIGINT does.

Brad

>>> On 5/27/2009 at 4:11 PM, in message
<[email protected]>, David Birdsong
<[email protected]> wrote:
> ok, so i just backed up into testing things i have a better grasp on.
> 
> i wrote a super simple python module that conforms to the template for
> python modules.  metric_cleanup gets called when gmond receives a
> SIGINT but not when it receives a SIGTERM.
> 
> the gmond init script installed by default from a fedora rpm will call
> 'killproc' which is defined by the distro.  killproc defaults to send
> a SIGTERM first, wait then send a SIGKILL.
> 
> shouldn't gmond catch a SIGTERM and exit gracefully?
> 
> On Wed, May 27, 2009 at 1:40 PM, David Birdsong
> <[email protected]> wrote:
>> thanks bernard, that sped me along.
>>
>> i'm admittedly pretty green to debugger's in general, and i'm not
>> quite sure if there's special kung fu in debugging a process's signal
>> handler as it, if i understand signals correctly, is installed on a
>> different stack.
>>
>> i:
>> - start gmond -d2 in one term
>> - attach to the running gmond process
>> - set a breakpoint for both apr_terminate and apr_pool_destroy
>> - continue
>>
>> ....gdb will hang while gmond runs it's loop, the non-forked gmond
>> window confirms that it's looping periodically collecting metrics and
>> sending them off
>>
>> - send gmond a TERM signal, i get this from gdb:
>>
>> Program received signal SIGTERM, Terminated.
>> [Switching to Thread 140540029593328 (LWP 11780)]
>> 0x0000003121ed50d8 in epoll_wait () from /lib64/libc.so.6
>>
>> ...maybe that thread is the signal handler? not sure.
>>
>> it occurred to me that gdb could be interfering with the SIGTERM, so i 
> added:
>> (gdb) handle SIGTERM nostop
>> ...but this changed nothing.
>>
>> i also notice that if i set the breakpoints and left gmond running in
>> gdb longer, i'd start hitting apr_pool_destroy.c:716 for every metric
>> as it was being sent out(as confirmed by the interactive gmond window)
>>
>> i could continue for each breakpoint, but this just repeated...i'm not
>> sure if i'm actually discovering anything here.
>>
>> On Wed, May 27, 2009 at 12:41 PM, Bernard Li <[email protected]> wrote:
>>> Hi David:
>>>
>>> On Tue, May 26, 2009 at 6:22 PM, David Birdsong
>>> <[email protected]> wrote:
>>>
>>>> I've been searching around for awhile now, any suggestions on where I
>>>> can get apr-debug ...or is it apr-util-debug?   I'm on Fedora 8, but
>>>> source is fine.
>>>
>>> Perhaps you are looking for the apr-debuginfo RPM?
>>>
>>> 
> http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/8/Everyth 
> ing/i386/debug/apr-debuginfo-1.2.11-2.i386.rpm
>>>
>>> Cheers,
>>>
>>> Bernard
>>>
>>
> 
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, & 
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
> _______________________________________________
> Ganglia-general mailing list
> [email protected] 
> https://lists.sourceforge.net/lists/listinfo/ganglia-general 




------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to