Ticket #1243 defect closed fixed

Opened 8 years ago

Last modified 8 years ago

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

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

Change History

Changed 8 years ago by ghazel

1

Changed 8 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.

2

Changed 8 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.

3

Changed 2 years ago by <automation>

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