Ticket #6217 defect new

Opened 5 months ago

Last modified 3 weeks ago

iocpreactor events do not occur at the time they should

Reported by: BrianMatthews Owned by:
Priority: normal Milestone:
Component: core Keywords: iocpreactor review
Cc: Branch:
Author: Launchpad Bug:

Description

When multiple writes are queued to a Perspective Broker connection, the success callbacks all occur at the same time. When using the default select reactor, the events occur as each write succeeds.

Attached are two scripts, pbecho.py (server) and pbechoclient.py (the client) with the select reactor (iocpreactor commented out) the 'Transfer Done' messages in the client occur when 'Transfer some data' messages appear in the server.

With the iocpreactor, the 'Transfer Done' messages all occur at once when all 4 data transfers are complete.

Attachments

pbecho.py Download (1.6 KB) - added by BrianMatthews 5 months ago.
pbechoclient.py Download (2.0 KB) - added by BrianMatthews 5 months ago.
reactor.py.diff Download (1.6 KB) - added by BrianMatthews 5 months ago.
test_iocp_sequence.py Download (4.5 KB) - added by BrianMatthews 5 months ago.

Change History

Changed 5 months ago by BrianMatthews

Changed 5 months ago by BrianMatthews

1

Changed 5 months ago by BrianMatthews

  • priority changed from normal to high
  • milestone set to regular-releases

2

Changed 5 months ago by exarkun

  • priority changed from high to normal
  • keywords twisted reactor removed
  • milestone regular-releases deleted

The regular-releases milestone is for release automation tools.

3

Changed 5 months ago by BrianMatthews

The problem is in iocpreactor/reactor.py. The doIteration loop fetches an event, and processes the callback immediately. This can result in a self-perpetuating loop if the callback produces more I/O events. The fix is to fetch all events first, then process them. This makes it the same as the selectreactor. I have attached a unified diff made against revision #32813 that fixes the issue. So far I have not been able ot make a simple one-process unit test to show this, I will try later. It is easy to reproduce in two-process tests.

Changed 5 months ago by BrianMatthews

Changed 5 months ago by BrianMatthews

4

Changed 5 months ago by BrianMatthews

Unit tes test_iocp_sequence added. It fails when using iocpreactor, passes with selectreactor, and passes with the patched iocpreactor

5

Changed 3 weeks ago by itamar

  • keywords review added

Thanks for the patch! Please add "review" keyword with patches, so we know to look at them.

Note: See TracTickets for help on using tickets.