Hello, http://bugs.python.org/issue5103 fixed a bug in Python2.6 where SSL's handshake would hang indefinitely if the remote end hangs.
However, I'm getting hanging behavior in an IMAP script. When I Ctrl-C it after hours of hanging, I get the same stacktrace as reported in http://bugs.python.org/issue1251#msg72363 , though Antoine said that r80452 fixed issue 5103 as well as this bug. This script sends automatic response emails. Every 10 seconds it uses IMAP to check for unread messages in a GMail label, then replies via SMTP and marks the message as read. The script seems to work the first time an unread message is found; the next time there's a message to be had, it hangs trying to complete the SSL handshake. File "./main.py", line 21, in thank_new_signups the_emails = list(emails.messages('(UNSEEN)')) File "./emails.py", line 129, in messages for chunk in chunks_of_length(32, messages): File "./chunks.py", line 9, in chunks_of_length for item in iterable: File "./emails.py", line 90, in email_messages m = open_mailbox(label, readonly=True) File "./emails.py", line 30, in open_mailbox m = imaplib.IMAP4_SSL('imap.gmail.com', 993) File "/usr/lib64/python2.6/imaplib.py", line 1138, in __init__ IMAP4.__init__(self, host, port) File "/usr/lib64/python2.6/imaplib.py", line 163, in __init__ self.open(host, port) File "/usr/lib64/python2.6/imaplib.py", line 1150, in open self.sslobj = ssl.wrap_socket(self.sock, self.keyfile, self.certfile) File "/usr/lib64/python2.6/ssl.py", line 338, in wrap_socket suppress_ragged_eofs=suppress_ragged_eofs) File "/usr/lib64/python2.6/ssl.py", line 120, in __init__ self.do_handshake() File "/usr/lib64/python2.6/ssl.py", line 279, in do_handshake self._sslobj.do_handshake() KeyboardInterrupt (This behavior started only in the last couple of weeks after a longer period working correctly, so I suspect something changed on GMail's end to trigger the bug.) Am I do something wrong, or is this bug still not fixed? Any pointers would be appreciated. Python 2.6.6 (r266:84292, Dec 7 2011, 20:48:22) on 64-bit Linux 2.6.32. Michael
-- http://mail.python.org/mailman/listinfo/python-list