New submission from Anthony Lozano: If you create a asynchat subclass with a SSL socket asyncore can hang when data larger than the ac_in_buffer_size comes in.
What (I think) happens is that asyncore uses a select.select call to determine when to read more data from the socket. On the first call, this will correctly see that there is data to recv and we will continue on to the handle_read function in asynchat. Once there, if there is more than ac_in_buffer_size data to read, handle_read will not find the terminator, and thus not call find_terminator, expecting to find it on the next pass with another self.recv. Unfortunately, the SSL wrapped socket will not play nicely with next select call (the one that should be triggering the next handle_read) because the ssl socket might internally read more data, and select is looking at the raw socket which is empty now thanks to ssl (at least according to an answer here: http://stackoverflow.com/questions/3187565/select-and-ssl-in-python). A solution would be to check the if the socket has any data pending with the sslsock.pending() method and read the rest out. I am doing this in the handle_read function of my child class as attached, but I don't know if that's a generic enough solution for everyone. ---------- components: None files: asychat_fix.py messages: 180058 nosy: Anthony.Lozano priority: normal severity: normal status: open title: Asyncore/asynchat hangs when used with ssl sockets type: crash versions: Python 2.7 Added file: http://bugs.python.org/file28746/asychat_fix.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16976> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com