From: Brad N. <BNI...@no...> - 2008-01-18 19:54:37
|
I can check it in. Brad >>> On 1/18/2008 at 12:42 PM, in message <Pin...@pr...>, Matthias Blankenhaus <mat...@sg...> wrote: >=20 > On Fri, 18 Jan 2008, Brad Nicholes wrote: >=20 >> From what I have read about the popen2 interface, I think you are = right. =20 > It was either that or having to manually close the stdin. >> >=20 > I don't think I haved write access to the tree. Could you pl. check it = in=20 > or does Bernard takes care of this ? >=20 > Matthias > =20 >> Brad >>=20 >> >>> On 1/18/2008 at 11:34 AM, in message >> <Pin...@pr...>, Matthias >> Blankenhaus <mat...@sg...> wrote: >>=20 >> >=20 >> > On Fri, 18 Jan 2008, Brad Nicholes wrote: >> >=20 >> >> I am seeing the same thing. It goes away if I use the subprocess = module.=20 > =20 >> > There must be some problem in the way that popen2 is invoked that = is=20 > leaving=20 >> > a defunct process. >> >=20 >> > This fixes the problem: >> >=20 >> > 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=20 >> > lines >> > netstat_output=3Dpopen2.popen2(["netstat", '-t', = '-a'],=20 >> > mode=3D'r')[0].read() >> > lines =3D netstat_output.splitlines() >> > + os.wait() >> >=20 >> > #Iterate through the netstat output looking for the = 'tcp'=20 >> > keyword in the tcp_at >> > # position and the state information in the tcp_state_at= =20 >> > position. Count each >> >=20 >> >=20 >> >=20 >> > Matthias >> >=20 >> >=20 >> >=20 >> >>=20 >> >> Brad >> >>=20 >> >> >>> On 1/17/2008 at 7:37 PM, in message >> >> <d4c...@ma...>, = "Bernard Li" >> >> <be...@va...> wrote: >> >> > Hi Brad: >> >> >=20 >> >> > I'm not sure if my patch caused this, or this is a standard = behaviour >> >> > of tcpconn: >> >> >=20 >> >> > 17825 ? Ssl 0:00 /usr/sbin/gmond >> >> > 17864 ? Z 0:00 \_ [netstat] <defunct> >> >> >=20 >> >> > Can you check whether you have the same thing when you startup = your gmond? >> >> >=20 >> >> > Thanks, >> >> >=20 >> >> > Bernard >> >> >=20 >> >> > On 1/16/08, Brad Nicholes <BNI...@no...> wrote: >> >> >> >>> On 1/16/2008 at 11:44 AM, in message >> >> >> <d4c...@ma...>, = "Bernard Li" >> >> >> <be...@va...> wrote: >> >> >> > Hi Brad: >> >> >> > >> >> >> > On 1/15/08, Brad Nicholes <BNI...@no...> 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=20 >> > by=20 >> >> > design, goes into an infinite loop. I guess the while loop could = check=20 > for=20 >> >=20 >> >> > an exit command, but then it is only for testing purposes anyway = so=20 >> > whatever=20 >> >> > the mechanism is to kill the script is probably OK. >> >> >> >> >> >> Brad >> >> >> >> >> >> >> >>=20 >> >>=20 >> >>=20 >> >>=20 >>=20 >>=20 >>=20 >>=20 |