I traced the bug and found it occurred when our imap server close connection after imap authentication.<br><br>It seems that SSLSocket.read() cannot raise exception in this situation. It return 0.<br><br>Then IMAP4_SSL.readline() go into infiniteloop: <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; def readline(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; """Read line from remote."""<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line = []<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while 1:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char = self.sslobj.read(1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line.append(char)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if char == "\n": return ''.join(line)<br><br>I would modify imaplib.py to resolve the problem. But I think it's a bug of SSLSocket.read(), right?<br><br><div id="mailcontent"><blockquote dir="ltr" style="border-left: 2px solid rgb(0, 0, 0); margin-left: 10px; margin-right: 0px; padding-left: 5px; padding-right: 0px; font: 9pt 宋体;">Any idea what the crash is?  Is it popping up the normal windows <br>crash UI (if on Windows) or is it printing an exception and<br>exiting?  If it is crashing w/ the windows error reporting dialog<br>can you run it under a debugger?<br><br>I tried this against gmail and it worked fine for me.<br><p></p></blockquote></div>