Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
724 views
in Technique[技术] by (71.8m points)

python - uwsgi throws IO error caused by uwsgi_response_write_body_do broken pipe

My application is a uwsgi+django setup. I use gevent to do performance testing and run 1200 requests concurrently. At this point, uwsgi will throw an IO error with the following log message:

uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 260]
IOError: write error

Django 1.4.0
uwsgi: 1.9.13
python: 2.6
TCP Listen queue: 1000

What is the cause of this broken pipe error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This can happen when NGINX started a request to uWSGI but uWSGI took too long to respond, then NGINX closes the connection to uWSGI. When uWSGI finally finishes, it tries to give it's response back to NGINX, but NGINX closed the connection earlier, so then uWSGI throws an I/O error.

So this could mean that your uWSGI process is taking too long.

Update:

uWSGI's Harakiri mode could be useful to automatically terminate such long taking processes if you want to: https://uwsgi-docs.readthedocs.io/en/latest/FAQ.html#what-is-harakiri-mode You might not want to do this because a process might be finishing some long query or something which is necessary.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...