woof crashes when trying to upload file on Python 2.7

Bug #841408 reported by Jim Cheetham
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
woof (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

woof will start and handle HTTP requests successfully, but when actually trying to upload a file to the end-user it will crash with the following dump :-

$ woof -s
Now serving on http://IPADDR:8080/
HOSTNAME - - [05/Sep/2011 11:00:47] "GET /woof" 200 -
[Errno 32] Broken pipe
Connection broke. Aborting
----------------------------------------
Exception happened during processing of request from ('CLIENTIP', 47979)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 641, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 694, in finish
    self.wfile.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------

According to our ArchLinux friends http://aur.archlinux.org/packages.php?ID=46323 this seems to be caused by some side-effect of forking a child process to handle the file upload; using the patch from npouillard to make woof single-threaded http://paste.pocoo.org/show/363409/ is successful.

Applying this patch is not ideal, as it removes capability from the product (i.e. multiple simultaneous client downloads) but on the other hand it will at least be able to upload something instead of nothing!

Related branches

Changed in woof (Ubuntu):
status: New → Confirmed
Revision history for this message
Andrea Gualano (andrea-gualano) wrote :

The relevant patch in the ArchLinux tarball is woof-nofork.patch which, as the OP says, removes some functionality.

There is also a proposed patch in FreeBSD that may be worth a look:
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/159951

summary: - woof crashes when trying to upload file
+ woof crashes when trying to upload file on Python 2.7
Revision history for this message
Andrea Gualano (andrea-gualano) wrote :

It is worth noting that the crash only happens when running woof on Python 2.7; it works correctly on Python 2.6 (and probably on earlier versions).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package woof - 20091227-2

---------------
woof (20091227-2) unstable; urgency=low

  * debian/patches added:
    - 0001-fixes-python27-crash.patch (LP: #841408)
    - 0002-adds-stdin-support.patch (Closes: #638635) Thanks to Hugues Hiegel
 -- Andrea Gasparini <email address hidden> Sun, 25 Sep 2011 09:54:03 +0000

Changed in woof (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
hackel (hackel) wrote :

I am still getting the same error after installing woof 20091227-2 from oneric.

Exception happened during processing of request from ('186.109.90.50', 19726)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 641, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 694, in finish
    self.wfile.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

Revision history for this message
hackel (hackel) wrote :

My apologizes for the bug-spam, please disregard previous comment, I didn't realize I had an old woof in my path. Sorry.

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.