asyncio subprocess PIPE output lost

yuzhichang yuzhichang at gmail.com
Wed Aug 20 00:04:15 EDT 2014


On Wednesday, August 20, 2014 1:08:17 AM UTC+8, Kushal Kumaran wrote:
> On Tue, Aug 19, 2014 at 1:09 PM, yuzhichang <yuzhichang at gmail.com> wrote:
> 
> > Hi all,
> 
> >     I'm new to asyncio introduced by Python 3.4. I created two tasks each pings a host. I noticed some pieces of output will be lost(see "error: found icmp_seq gap"). If I changed to run only one task, this problem never occur.
> 
> >     Do you have any idea?
> 
> >     Thanks!
> 
> > Zhichang
> 
> >
> 
> > zhichyu at cto-team-6:~$ python3 asyn2.py
> 
> > got line: b'PING tyr.global.tektronix.net (10.250.163.252) 56(84) bytes of data.\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=2 ttl=55 time=204 ms\n'
> 
> > got line: b'PING babylon.rich.tek.com (10.250.155.123) 56(84) bytes of data.\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=2 ttl=55 time=205 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=3 ttl=55 time=205 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=3 ttl=55 time=205 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=4 ttl=55 time=196 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=4 ttl=55 time=198 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=5 ttl=55 time=181 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=5 ttl=55 time=182 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=6 ttl=55 time=180 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=6 ttl=55 time=179 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=7 ttl=55 time=193 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=7 ttl=55 time=196 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=8 ttl=55 time=185 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=8 ttl=55 time=187 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=9 ttl=55 time=213 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=9 ttl=55 time=211 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=10 ttl=55 time=192 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=10 ttl=55 time=192 ms\n'
> 
> > got line: b'64 bytes from tyr.global.tektronix.net (10.250.163.252): icmp_seq=11 ttl=55 time=210 ms\n'
> 
> > got line: b'64 bytes from babylon.rich.tek.com (10.250.155.123): icmp_seq=12 ttl=55 time=210 ms\n'
> 
> > error: found icmp_seq gap!
> 
> >
> 
> > <snipped code>
> 
> 
> 
> Before looking for possible bugs in your code, the first thing to
> 
> check would be if you are actually missing ping replies, rather than
> 
> output from the ping command.  Try increasing the timeout (-W) for the
> 
> ping command.  If you're familiar with tools like tcpdump and
> 
> wireshark, you could use those to examine the network traffic and see
> 
> if replies are missing.
> 
> 
> 
> -- 
> 
> regards,
> 
> kushal


Hi kushal,
    Wireshark shows some replies are missing. Changing destinations to localhost in code also fix the "icmp_seq gap" error. I should be more careful on debug these things.
    Thanks for your help!
Zhichang
   



More information about the Python-list mailing list