M
M
melikbekyan2017-05-19 18:07:41
Python
melikbekyan, 2017-05-19 18:07:41

What could be the problem with 500 and 502 nginx+uwsgi+postgreSQL errors?

I use nginx+uwsgi+postgreSQL stack
at 100 requests per second load everything is fine, all requests are returned with code 200
at 200 requests per second load 34% of requests are returned with 500 and 34% with 502.
what could be the problem?
who can help to figure it out, write to the mail [email protected]
in the nginx logs writes:

2017/05/19 18:01:04 [error] 35171#0: *150316 connect() to unix:///usr/local/var/run/ss.sock failed (61: Connection refused) while connecting to upstream, client: 10.0.1.5, server: 10.0.1.5, request: "POST /person/create_order/ HTTP/1.1", upstream: "uwsgi://unix:///usr/local/var/run/ss.sock:", host: "10.0.1.3:8000", referrer: "http://127.0.0.1:8000/person/create_order/"

uwsgi logs says:
Fri May 19 19:49:25 2017 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 296] during POST /driver/perform_order (10.0.1.5)
OSError: write error
[pid: 36037|app: 0|req: 80/758] 10.0.1.5 () {46 vars in 881 bytes} [Fri May 19 19:49:25 2017] POST /driver/perform_order => generated 0 bytes in 237 msecs (HTTP/1.1 200) 3 headers in 0 bytes (0 switches on core 0)
Fri May 19 19:49:25 2017 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /person/current_orders/ (ip 10.0.1.5) !!!
Fri May 19 19:49:25 2017 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 296] during GET /person/current_orders/ (10.0.1.5)
OSError: write error
[pid: 36039|app: 0|req: 42/759] 10.0.1.5 () {46 vars in 898 bytes} [Fri May 19 19:49:25 2017] GET /person/current_orders/ => generated 0 bytes in 260 msecs (HTTP/1.1 200) 3 headers in 0 bytes (0 switches on core 0)
Fri May 19 19:49:25 2017 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /auth/login/ (ip 10.0.1.5) !!!
Fri May 19 19:49:25 2017 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 296] during POST /auth/login/ (10.0.1.5)
OSError: write error
[pid: 36035|app: 0|req: 53/760] 10.0.1.5 () {46 vars in 837 bytes} [Fri May 19 19:49:24 2017] POST /auth/login/ => generated 0 bytes in 811 msecs (HTTP/1.1 200) 3 headers in 0 bytes (0 switches on core 0)
Fri May 19 19:49:25 2017 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /person/create_order/ (ip 10.0.1.5) !!!

in potsgresSQL, the maximum number of connections is set to 500 , here are the nginx
settings :
worker_processes  1;
worker_rlimit_nofile 100480;

error_log  logs/error.log;
error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  8192;
}

here are the uwsgi settings
[uwsgi]

# Настройки, связанные с Django
# Корневая папка проекта (полный путь)
chdir           = /Users/vage/PycharmProjects/your-taxi/backend/taxiProject/
# Django wsgi файл
#module          = project.wsgi
wsgi-file =  /Users/vage/PycharmProjects/your-taxi/backend/taxiProject/taxiProject/wsgi.py


# общие настройки
# master
master          = true
# максимальное количество процессов
processes       = 15
#disable-logging = True
enable-threads = True
# полный путь к файлу сокета
socket          = /usr/local/var/run/ss.sock
# права доступа к файлу сокета
 chmod-socket    = 666
# очищать окружение от служебных файлов uwsgi по завершению
vacuum          = true

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
melikbekyan, 2017-05-26
@melikbekyan

the problem is solved, it was necessary to increase the number of tcp connections in the operating system

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question