Opened 9 years ago

Last modified 9 years ago

#1243 defect closed fixed (fixed)

not writing or writing nothing from resumeProducing breaks production

Reported by: ghazel Owned by:
Priority: high Milestone:
Component: Keywords:
Cc: exarkun, ghazel Branch:
Author: Launchpad Bug:

Description


Attachments (1)

producer.py (2.1 KB) - added by ghazel 9 years ago.

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by ghazel

comment:1 Changed 9 years ago by ghazel

Within an IProducer's resumeProducing call, if you do not write, or you write a 
zero-length object (like '') the production stops, and the producer will not be 
asked for more data again.

(ghazel): ok, write()ing from resumeProducing seems to be necessary
(ghazel): I think it unregisters the producer if you write('') or don't write
(exarkun): ghazel: er
(exarkun): ghazel: if it does, it is a bug

The demo randomly does not write, writes '', or writes a series of asterisks. 
After a few runs, you should notice that data always stops being written after 
one of the two mentioned problem cases occur - with an error in the case of '' 
and silently in the case of not writing.

comment:2 Changed 9 years ago by exarkun

This seems to be a misunderstanding of IProducer/IConsumer.

You don't have to call .write() synchronously within resumeProducing, but you
*do* have to call .write() eventually.  resumeProducing means "the buffer became
empty" - you only get that notification when the event happens, not repeatedly
ever afterwards.

If you change your "not writing" branch to do a write with reactor.callLater,
for example, you should see this undesirable behavior go away.

comment:3 Changed 4 years ago by <automation>

  • Owner exarkun deleted
Note: See TracTickets for help on using tickets.