Closed Bug 744929 Opened 12 years ago Closed 12 years ago

Snappy Symbolication Server - Mismatched Content-Length and body length may result in exception

Categories

(Core :: Gecko Profiler, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: dchanm+bugzilla, Unassigned)

References

Details

This may be the expected behavior of the underlying library.

STR
1. curl -H "Content-Length: 1" -d ""  http://127.0.0.1:8000/
2. Terminate curl on client with Ctrl-C

Expected
No exception?

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 64014)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 560, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.6/SocketServer.py", line 617, in __init__
    self.handle()
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
    method()
  File "symbolicationWebService.py", line 82, in do_POST
    self.sendHeaders(400)
  File "symbolicationWebService.py", line 50, in sendHeaders
    self.send_response(errorCode)
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 384, in send_response
    self.send_header('Server', self.version_string())
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 390, in send_header
    self.wfile.write("%s: %s\r\n" % (keyword, value))
  File "/usr/lib/python2.6/socket.py", line 318, in write
    self.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe
----------------------------------------
I added a check for mismatched Content-Length and body length which prevents this exception.

Patch with all the sec-review fixes: https://github.com/vdjeric/Snappy-Symbolication-Server/commit/67705706c605984e220f69469a68b455813923f5

I think the true cause of this exception is a bug in the Python SocketServer library -- the SocketServer lib should not be calling flush on a broken pipe when finishing up a request. I filed a Python bug here: http://bugs.python.org/issue14574
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.