title: Google App Engine & jQuery Ajax causes a Broken Pipe error
body: <p>I have a pretty standard case, where I try to submit some JSON data via jQuery's Ajax.</p>
  
  <p>My Java Script code looks like this:</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type='text/javascript' src='script.js'&gt;&lt;/script&gt;
  &lt;script type='text/javascript'&gt;
      $(document).ready(function() {
          $("#submit").click(function() {
              $.post('/test', {test : '123'}, function(data) { alert("callback received"); }, 'json');
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>On the App Engine side I have this:</p>
  
  <pre><code>class Submit(webapp.RequestHandler):
      def post(self):
          logging.info(self.request.body)
          self.response.out.write("test_response")
  </code></pre>
  
  <p>I receive the JSON data <code>logging.info(self.request.body)</code> perfectly, but then it triggers an error as soon as I send out the response. The error log I get is the following:</p>
  
  <pre><code>Exception happened during processing of request from ('192.168.2.8', 38875)
  Traceback (most recent call last):
    File "/usr/lib/python2.6/SocketServer.py", line 283, in handle_request_noblock
      self.process_request(request, client_address)
    File "/usr/lib/python2.6/SocketServer.py", line 309, in process_request
      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 "/home/hw/Siine/google_appengine/google/appengine/tools/dev_appserver.py", line 3123, in init_
      BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
    File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
      self.finish()
    File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
      self.wfile.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
  </code></pre>
  
  <p>I have absolutely no idea what I do wrong, since this seems straightforward.</p>