Aha! This appears to be a bug in OS X or in Python. It sounds very
similar to this:
http://www.cherrypy.org/ticket/598
Following that cherrypy ticket, I changed the Connection class in
rocket.py:
removed:
self.sendall = self.socket.sendall
added:
def sendall(self, buf):
pending = len(buf)
offset = 0
while pending:
try:
sent = self.socket.send(buf[offset:])
pending -= sent
offset += sent
except socket.error, e:
if e[0]!=errno.EAGAIN:
raise
I was seeing EAGAIN raised frequently when socket.sendall() was called
repeatedly. It looks like socket.sendall(), instead of catching the
EAGAIN and retrying, a socket.error is raised.