From what I have read about the popen2 interface, I think you are right.  It 
was either that or having to manually close the stdin.

Brad

>>> On 1/18/2008 at 11:34 AM, in message
<[EMAIL PROTECTED]>, Matthias
Blankenhaus <[EMAIL PROTECTED]> wrote:

> 
> On Fri, 18 Jan 2008, Brad Nicholes wrote:
> 
>>   I am seeing the same thing.  It goes away if I use the subprocess module.  
> There must be some problem in the way that popen2 is invoked that is leaving 
> a defunct process.
> 
> This fixes the problem:
> 
>  diff -u tcpconn.py tcpconn.py.new
> --- tcpconn.py  2008-01-18 10:34:05.000000000 -0800
> +++ tcpconn.py.new      2008-01-18 10:33:58.000000000 -0800
> @@ -212,6 +212,7 @@
>              #Call the netstat utility and split the output into separate 
> lines
>              netstat_output=popen2.popen2(["netstat", '-t', '-a'], 
> mode='r')[0].read()
>              lines = netstat_output.splitlines()
> +            os.wait()
> 
>              #Iterate through the netstat output looking for the 'tcp' 
> keyword in the tcp_at
>              # position and the state information in the tcp_state_at 
> position. Count each
> 
> 
> 
> Matthias
> 
> 
> 
>> 
>> Brad
>> 
>> >>> On 1/17/2008 at 7:37 PM, in message
>> <[EMAIL PROTECTED]>, "Bernard Li"
>> <[EMAIL PROTECTED]> wrote:
>> > Hi Brad:
>> > 
>> > I'm not sure if my patch caused this, or this is a standard behaviour
>> > of tcpconn:
>> > 
>> > 17825 ?        Ssl    0:00 /usr/sbin/gmond
>> > 17864 ?        Z      0:00  \_ [netstat] <defunct>
>> > 
>> > Can you check whether you have the same thing when you startup your gmond?
>> > 
>> > Thanks,
>> > 
>> > Bernard
>> > 
>> > On 1/16/08, Brad Nicholes <[EMAIL PROTECTED]> wrote:
>> >> >>> On 1/16/2008 at 11:44 AM, in message
>> >> <[EMAIL PROTECTED]>, "Bernard Li"
>> >> <[EMAIL PROTECTED]> wrote:
>> >> > Hi Brad:
>> >> >
>> >> > On 1/15/08, Brad Nicholes <[EMAIL PROTECTED]> wrote:
>> >> >
>> >> >>   works for me too.  Check it in :)
>> >> >
>> >> > Done -- BTW, when I try to run the script in the command prompt (i.e.
>> >> > python tcpconn.py), it doesn't exit even though I hit ctrl-c -- bug or
>> >> > feature?
>> >> >
>> >>
>> >> Not sure why it wouldn't exit on ctrl-c but the test portion of the 
>> >> script 
> by 
>> > design, goes into an infinite loop.  I guess the while loop could check 
>> > for 
> 
>> > an exit command, but then it is only for testing purposes anyway so 
> whatever 
>> > the mechanism is to kill the script is probably OK.
>> >>
>> >> Brad
>> >>
>> >>
>> 
>> 
>> 
>> 




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to