Ticket #3023 defect closed fixed

Opened 5 years ago

Last modified 5 years ago

[PATCH] twisted.spread.util.FilePager doesn't callback when sending an empty file

Reported by: zectbumo Owned by:
Priority: highest Milestone:
Component: pb Keywords:
Cc: therve Branch: branches/filepager-empty-file-3023
Author: therve Launchpad Bug:

Description

If you use FilePager to send an empty file then the completion callback never gets called.

Attachments

util.py.patch Download (0.8 KB) - added by zectbumo 5 years ago.
util.py.2.patch Download (0.5 KB) - added by zectbumo 5 years ago.
this also seems to fix it
test_pb.py.patch Download (1.2 KB) - added by zectbumo 5 years ago.

Change History

Changed 5 years ago by zectbumo

1

  Changed 5 years ago by therve

  • owner glyph deleted
  • keywords review added
  • component changed from core to pb

Changed 5 years ago by zectbumo

this also seems to fix it

2

  Changed 5 years ago by zectbumo

I like patch 2 better since it is more straight forward

3

follow-up: ↓ 4   Changed 5 years ago by therve

  • cc therve added
  • priority changed from normal to highest
  • owner set to zectbumo
  • keywords review removed

Thanks for the patch. Some comments:

  • while you're at it, please move Pager.__init__ in the first line of the __init__ method
  • your empty file doesn't need to be created in the setUp method as it's only used in your test. Please move the creation in your test, make it a local variable, and makes it follow twisted naming standard (filenameEmpty instead of self.filename_empty)
  • Use self.fail(msg) instead of raise Exception(msg)

Thanks!

Changed 5 years ago by zectbumo

4

in reply to: ↑ 3   Changed 5 years ago by zectbumo

  • keywords review added

Replying to therve:

* while you're at it, please move Pager.__init__ in the first line of the __init__ method

I wish I could. The problem gets bigger if I try that. Pager.init calls broker.registerPageProducer which eventually calls sendNextPage which needs a reference to self.chunks and self.chunks won't get initialize until after Pager.init. The problem comes down to that Pager.init is doing more than just initializing, it's also registering which causes wheels to start turning before we are done initializing.

* your empty file doesn't need to be created in the setUp method as it's only used in your test. Please move the creation in your test, make it a local variable, and makes it follow twisted naming standard (filenameEmpty instead of self.filename_empty) * Use self.fail(msg) instead of raise Exception(msg)

done

5

  Changed 5 years ago by zectbumo

  • owner changed from zectbumo to therve

6

  Changed 5 years ago by therve

  • status changed from new to closed
  • keywords review removed
  • resolution set to fixed

Fixed in r22475.

7

  Changed 5 years ago by therve

(In [22482]) Revert r22475: stupid print statement.

Refs #3023

8

  Changed 5 years ago by therve

  • status changed from closed to reopened
  • resolution fixed deleted

9

  Changed 5 years ago by therve

  • branch set to branches/filepager-empty-file-3023
  • author set to therve

(In [22485]) Branching to 'filepager-empty-file-3023'

10

  Changed 5 years ago by therve

(In [22486]) Apply the patch, without the print.

Refs #3023

11

  Changed 5 years ago by therve

  • owner therve deleted
  • status changed from reopened to new
  • keywords review added

12

  Changed 5 years ago by exarkun

  • keywords review removed
  • owner set to therve

Humm okay. I wish the PB code and tests were nicer. :(

But a bug is fixed, so this should go in. Thanks, please merge.

13

  Changed 5 years ago by therve

  • status changed from new to closed
  • resolution set to fixed

(In [22557]) Merge filepager-empty-file-3023

Authors: zectbumo, therve Reviewers: exarkun, therve Fixes #3023

Make twisted.spread.util.FilePager works with empty files: previously, it didn't callback correctly.

14

  Changed 2 years ago by <automation>

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