tags:

views:

48

answers:

2

Hi,

Sometimes, when submitting a form (pretty much any form on my site that sends me an email), I get the following error:

File "/usr/lib/python2.5/smtplib.py", line 603, in starttls
   (resp, reply) = self.docmd("STARTTLS")

 File "/usr/lib/python2.5/smtplib.py", line 378, in docmd
   return self.getreply()

 File "/usr/lib/python2.5/smtplib.py", line 352, in getreply
   line = self.file.readline()

 File "/usr/lib/python2.5/socket.py", line 381, in readline
   data = self._sock.recv(self._rbufsize)

error: (4, 'Interrupted system call')

My code is sending email via gmail. I am also using django contact-form which does the same thing.

The problem doesn't always happen. It seems very random. At one point today it got so bad that it displayed the error every time I submitted a form.

Restarting apache fixes the problem for one submission and then it does it again.

I have checked the RAM and there is plenty available (about 350MB available).

Can someone lead me in the right direction? What does this error mean? What can I do to prevent this.

Thanks.

A: 

I would say it got to do with a bad network connection to the smtp server. Looks like it gets interrupted while trying to read the reply from the server?

baloo
Is there anything I can do that would prevent the errors from happening? Something like try: this and if it fails, try again. Then maybe after 3 attempts, just skip the email sending? If so, what kind of exception would I catch for this?
mhost
A: 

As a workaround, you may want to try increasing the socket timeout.

As for fixing this, you may not have a stable connection to GMail's server and there may not be a way around this.

It looks as if the EINTR signal is being thrown before the recv call gets any data back.

Nick Presta