This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author j1m
Recipients gvanrossum, j1m, vstinner, yselivanov
Date 2016-06-26.16:05:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466957117.0.0.423625085233.issue27392@psf.upfronthosting.co.za>
In-reply-to
Content
The event loop create_connection method can take a socket to create a connection on an existing socket, including sockets obtained via an external listener.  If an SSL context is provided, however, it assumes it's creating a client connection, making it impossible to use it in a server.

I've recently ported ZEO to asyncio. My original implementation used a separate thread for each connection and a thread for listening for connections.  I think there are cases where this makes a lot of sense.  Blocky operations only affect one client and, IMO, using an asynchronous model can simplify networking code even when there's only one connection. Unfortunately, this didn't work on Linux with SSL due to issues with SSL and non-blocking sockets. (Oddly, it worked fine on Mac OS X.)

I've switched my code to use create_server, but this has led to stability problems.  Beyond http://bugs.python.org/issue27386, I'm seeing a lot of test instability.  I can't get through the ZEO tests without some test failing, although the tests pass when run individually. I suspect that this is due to a problem in my error handling, asyncio's error handling, or likely both.

Note that the ZEO test suite is pretty ruthless, doing whatever they can to break ZEO servers and clients.

I have a version of my multi-threaded code that monkey-patches loop instances to pass server_side=True to _make_ssl_transport.  With that awful hack, I can use an external listener and tests usually run without errors. :)

I'd be more than happy to create a PR that adds this option (including test and docs). Please just give me the word. :)
History
Date User Action Args
2016-06-26 16:05:17j1msetrecipients: + j1m, gvanrossum, vstinner, yselivanov
2016-06-26 16:05:17j1msetmessageid: <1466957117.0.0.423625085233.issue27392@psf.upfronthosting.co.za>
2016-06-26 16:05:16j1mlinkissue27392 messages
2016-06-26 16:05:16j1mcreate