Title: Asyncore/asynchat hangs when used with ssl sockets
Type: behavior Stage:
Components: None Versions: Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Anthony.Lozano, BreamoreBoy, giampaolo.rodola
Priority: normal Keywords:

Created on 2013-01-15 22:02 by Anthony.Lozano, last changed 2014-06-22 10:12 by giampaolo.rodola. This issue is now closed.

File name Uploaded Description Edit Anthony.Lozano, 2013-01-15 22:02
Messages (4)
msg180058 - (view) Author: Anthony Lozano (Anthony.Lozano) Date: 2013-01-15 22:02
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 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:

 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.
msg180061 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2013-01-15 22:18
asyncore simply does not support SSL.
That is tracked in issue 10084.
msg221209 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-21 23:17
As issue10084 has been closed "won't fix" then the same must apply here.
msg221244 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2014-06-22 10:12
Date User Action Args
2014-06-22 10:12:46giampaolo.rodolasetstatus: open -> closed
resolution: wont fix
messages: + msg221244
2014-06-21 23:17:22BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221209
2013-01-15 22:18:28giampaolo.rodolasetmessages: + msg180061
2013-01-15 22:05:00pitrousetnosy: + giampaolo.rodola
2013-01-15 22:03:33Anthony.Lozanosettype: crash -> behavior
2013-01-15 22:02:45Anthony.Lozanocreate