[New-bugs-announce] [issue8771] Socket freezing under load issue on Mac.

Alice Bevan-McGregor report at bugs.python.org
Thu May 20 01:37:27 CEST 2010

New submission from Alice Bevan-McGregor <alice at gothcandy.com>:

Using the wsgiref simple HTTP server or any other capable of > 2000 requests/sec. demonstrates an issue with Macintosh sockets.

Mac OS X Version: 10.6.3 (Build 10D573)
Python Version: 2.6.1 (32-bit)

The minimal application needed to demonstrate the problem is:

    import sys, cStringIO
    from wsgiref.simple_server import make_server
    sys.stderr = cStringIO.StringIO() # disable request logging
    def app(environ, start_response):
        start_response("200 OK", [('Content-Type', 'text/plain')])
        return ['Hello world!\n']
    httpd = make_server('', 8080, app)

Then hammer the server using Apache Bench:

    ab -n 20000 -c 5

At almost exactly the 16000 request mark socket connections begin to time out.  Sockets are then freed up at the rate of about 40/second (on my box).  Killing the ab run when it freezes then immediately re-trying (and cancelling after a few seconds) will show this rate.  Time must pass for some connection 'pool' to free the connections before you can do another 16000 requests.

This problem does not appear on the following setup:

Operating System: Gentoo Linux
Python Version: 2.6.4 (32-bit)

components: Library (Lib)
messages: 106117
nosy: amcgregor
priority: normal
severity: normal
status: open
title: Socket freezing under load issue on Mac.
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list