[issue2808] asynchat forgets packets when push is called from a thread

xix xeaon report at bugs.python.org
Sat May 10 13:00:26 CEST 2008


New submission from xix xeaon <xix.xeaon at gmail.com>:

okay, my first bug post, hope I do it right.

if you push more than 512 bytes (issue2073) from a thread then only the
first packet will be sent, all other packets will be forgotten.

the remaining packets will be sent when something else happens, like a
new connection is opened, or more input data is read. it's also sent
when the select times out (default 30 seconds) and starts over.

if push is called twice then the first two packets will be sent but the
rest will be forgotten.

if this problem arises in your code then you can easily fix it with a 0
second timeout for loop(), or preferably something like 0.0001 so that
the cpu stays calm ;)

you should be able to reproduce this bug with the attached file, just
run it and then connect with netcat like:
echo "\n" | nc localhost 1100
netcat will print almost 6 and a half lines of x and then the rest after
5 seconds (30 seconds is boring..) or if you have wireshark up then
you'll see it easily.

and would someone please apply all the patches for this module! =)

----------
components: Library (Lib)
files: asyn-delay.py
messages: 66510
nosy: xix xeaon
severity: normal
status: open
title: asynchat forgets packets when push is called from a thread
type: behavior
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file10236/asyn-delay.py

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2808>
__________________________________


More information about the Python-bugs-list mailing list