Django - How to solve error "SIGPIPE: writing to closed pipe/socket/fd"

111 views Asked by At

My web app sends out an email to users utilizing a standard format per django.core.mail.message.EmailMessage.

It is received fine by most ISPs and browsers---but with one ISP, the emails are not being received by the users and these 2 related error messages are appearing on the PythonAnywhere server that I use:

SIGPIPE: writing to a closed pipe/socket/fd (probably the 
client disconnected) on request [a specific URL in your web 
app]

uwsgi_response_writev_headers_and_body_do(): Broken pipe 
[core/writer.c line 306] during [a specific URL in your web 
app]

My research suggests it could be a server time-out issue related to nginx and uwsgi--but I don't think I have either installed; this is a wsgi application. My gut suggests it could be this specific ISP blocking my emails because I've been testing so much and it considers them spam. Is that plausible? Any thoughts on the likely cause of these errors or how I could resolve?

1

There are 1 answers

1
Glenn On

That is what happens when the client disconnects before the response has been sent to it. It can happen because users close the tab they're on or because there is a timeout in code that accesses the site and the timeout is shorter than the response time. You can optimise your code to improve the response time or increase timeouts in the code that accesses the site.