branch-rewrite.py doesn't flush and leaves the seat up

Bug #475322 reported by Stuart Bishop
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Aaron Bentley

Bug Description

scripts/branch-rewrite.py needs to explicitly flush sys.stdout after printing a response for Apache and there is no guarantee it will be done implicitly. If the flush doesn't occur, the whole system blocks.

Tags: lp-code
Revision history for this message
Stuart Bishop (stub) wrote :

Needs to land for 3.1.11 or codehosting will likely fallover again.

Changed in launchpad-code:
importance: Undecided → High
milestone: none → 3.1.11
status: New → Triaged
Revision history for this message
Tom Haddon (mthaddon) wrote :

Diff is:

=== modified file 'scripts/branch-rewrite.py'
--- scripts/branch-rewrite.py 2009-07-24 07:08:33 +0000
+++ scripts/branch-rewrite.py 2009-11-05 12:31:00 +0000
@@ -53,6 +53,7 @@
                 # Mod-rewrite always gives us a newline terminated string.
                 if line:
                     print rewriter.rewriteLine(line.strip())
+ sys.stdout.flush()
                 else:
                     # Standard input has been closed, so die.
                     return

Revision history for this message
Tom Haddon (mthaddon) wrote :

Er, well, with proper indenting...

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

So what likely happened here is that the hashbang line in the script says "-u" and this wasn't carried over to invoking the script with "$rf/bin/py". It'd probably be a good idea to stick the -u back in -- otherwise I worry slightly about input buffering.

Changed in launchpad-code:
assignee: nobody → Aaron Bentley (abentley)
Revision history for this message
Aaron Bentley (abentley) wrote :

This has been fixed by supplying -u to the python interpreter, rather than using flush. This change has been made made in rewrite_wrapper.sh on crowberry (which is an unversioned file).

Changed in launchpad-code:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.