5

I'm running a Django 1.8 site, served by nginx and Gunicorn, with a Postgres 9.4 backend.

When I make lots of data-intensive calls to the site's API in succession, I've noticed about 1 in 100 queries failing, and serving up nginx 404 pages.

My first assumption was that the Postgres database was creaking under the load, but the Postgres logs in fact show me this:

2015年08月06日 14:33:43 UTC:127.0.0.1(42287):dbuser@dbname:[3737]: LOG: could not send data to client: Broken pipe
2015年08月06日 14:33:43 UTC:127.0.0.1(42287):dbuser@dbname:[3737]: STATEMENT: SELECT ... (psql statement)
2015年08月06日 14:33:43 UTC:127.0.0.1(42287):dbuser@dbname:[3737]: FATAL: connection to client lost
2015年08月06日 14:33:43 UTC:127.0.0.1(42287):dbuser@dbname:[3737]: STATEMENT: SELECT ... (psql statement)

I think what this is saying is that Postgres is actually running the queries OK, but that it can't send data through to the client.

So I think to debug this problem, I should actually look at Django/Gunicorn/nginx instead.

Have I understood this correctly?

asked Aug 10, 2015 at 0:59
1
  • Have you found the solution? Commented Jun 24, 2023 at 15:45

1 Answer 1

6

Yes, it seems like you've understood this correctly. The client sent the data to a postgresql backend, and then abruptly disconnected (or was killed). The message is basically "I have an answer for you, but I have nowhere to send it!"

I would definitely look at the logs of the other services and compare timestamps to try and look deeper into what is going on.

Hope that helps. =)

answered Aug 10, 2015 at 1:53
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.