Author xdegaye
Recipients Pierrick.Koch, andy_js, giampaolo.rodola, xdegaye
Date 2013-05-29.12:40:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The problem is that when the fifo contains a producer and the more()
method of the producer returns a non-empty bytes sequence, then the
producer must be put back in the fifo first. This is what does the
following change made to Pierrick patch:

diff --git a/Lib/ b/Lib/
--- a/Lib/
+++ b/Lib/
@@ -229,6 +229,7 @@
             except TypeError:
                 data = first.more()
                 if data:
+                    self.producer_fifo.appendleft(first)

The asynchat test is OK when the patch is modified with the above

However, then the patch does not make initiate_send() thread safe.
There is now a race condition: another thread may be allowed to run
between the two appendleft() calls, this other thread may then call
the more() method of 'first' and send the returned bytes. When that
happens, the sent data is mis-ordered.
Date User Action Args
2013-05-29 12:40:26xdegayesetrecipients: + xdegaye, giampaolo.rodola, Pierrick.Koch, andy_js
2013-05-29 12:40:25xdegayesetmessageid: <>
2013-05-29 12:40:25xdegayelinkissue17925 messages
2013-05-29 12:40:25xdegayecreate