Issue 15470: Stuck/hang when reading ssl object (original) (raw)

My python scripting has been running for several weeks periodically sending out emails. However the script has been stuck for the last 24 hrs. No parts of my script have been executed in this period.

On terminating the script via ctrl-c, I can see that the script is stuck with the python ssl library. See below;


File "/export2/home/intregress/LabEnv210/lab/int_lib/int_tools/PTM_COMMON/user.py", line 4277, in email mailServer.sendmail(gmail_user, to, msg.as_string()) File "/tools/ACTIVESTATE/python/2.7.1.3/x86/lib/python2.7/smtplib.py", line 713, in sendmail (code,resp) = self.data(msg) File "/tools/ACTIVESTATE/python/2.7.1.3/x86/lib/python2.7/smtplib.py", line 482, in data (code,msg)=self.getreply() File "/tools/ACTIVESTATE/python/2.7.1.3/x86/lib/python2.7/smtplib.py", line 338, in getreply line = self.file.readline() File "/tools/ACTIVESTATE/python/2.7.1.3/x86/lib/python2.7/smtplib.py", line 177, in readline chr = self.sslobj.read(1) File "/tools/ACTIVESTATE/python/2.7.1.3/x86/lib/python2.7/ssl.py", line 138, in read return self._sslobj.read(len)

Well, the traceback shows it's stuck trying to read from the network. It doesn't mean it's stuck in the ssl library; unless your script was taking 100% CPU when you killed it, it was most likely waiting for the peer (a SMTP server, I guess) to respond.

One suggestion would be to add a timeout to the SMTP connection. You can also use set_debuglevel() to get more detailed info about what's happening.