Ошибка: open socket # left in connection
vaarsn
nginx-forum на forum.nginx.org
Чт Янв 5 15:28:51 UTC 2017
Имеется Nginx 1.10.0 включающий следующую конфигурацю:
----------------------------------------------------------------------------------------------
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 25;
types_hash_max_size 2048;
server_tokens off;
send_timeout 2;
reset_timedout_connection on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log /var/log/nginx/error.log debug;
log_not_found off;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
gzip on;
gzip_disable "msie6";
----------------------------------------------------------------------------------------------
При рестарте наблюдаю в логах следующую ошибку:
2017/01/05 15:01:35 [alert] 1186#1186: *13388 open socket #15 left in
connection 17
2017/01/05 15:01:35 [alert] 1186#1186: *13441 open socket #45 left in
connection 22
2017/01/05 15:01:35 [alert] 1186#1186: *13444 open socket #48 left in
connection 26
..........................
Включил режим отладки, но толком тоже ничего:
2017/01/05 15:18:17 [debug] 1566#1566: epoll del event: fd:6 op:2
ev:00000000
2017/01/05 15:18:17 [debug] 1566#1566: epoll del event: fd:8 op:2
ev:00000000
2017/01/05 15:18:43 [debug] 1565#1565: post event 0000561F259CD460
2017/01/05 15:18:43 [debug] 1565#1565: delete posted event 0000561F259CD460
2017/01/05 15:18:43 [debug] 1565#1565: accept on 0.0.0.0:80, ready: 1
2017/01/05 15:18:43 [debug] 1565#1565: posix_memalign: 0000561F25A59750:512
@16
2017/01/05 15:18:43 [debug] 1565#1565: *5055 accept: 40.77.167.4:11355
fd:36
2017/01/05 15:18:43 [debug] 1565#1565: *5055 event timer add: 36:
60000:1483629583790
2017/01/05 15:18:43 [debug] 1565#1565: *5055 reusable connection: 1
2017/01/05 15:18:43 [debug] 1565#1565: *5055 epoll add event: fd:36 op:1
ev:80002001
2017/01/05 15:18:43 [debug] 1565#1565: accept() not ready (11: Resource
temporarily unavailable)
2017/01/05 15:18:43 [debug] 1565#1565: *5055 post event 0000561F259CDD60
2017/01/05 15:18:43 [debug] 1565#1565: *5055 delete posted event
0000561F259CDD60
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http wait request handler
2017/01/05 15:18:43 [debug] 1565#1565: *5055 malloc: 0000561F25A79AC0:1024
2017/01/05 15:18:43 [debug] 1565#1565: *5055 recv: fd:36 242 of 1024
2017/01/05 15:18:43 [debug] 1565#1565: *5055 reusable connection: 0
2017/01/05 15:18:43 [debug] 1565#1565: *5055 posix_memalign:
0000561F25A4A620:4096 @16
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http process request line
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http request line: "GET
/robots.txt HTTP/1.1"
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http uri: "/robots.txt"
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http args: ""
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http exten: "txt"
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http process request header
line
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http header: "Cache-Control:
no-cache"
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http header: "Connection:
Keep-Alive"
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http header: "Pragma:
no-cache"
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http header: "Accept: */*"
2017/01/05 15:18:43 [debug] 1565#1565: *5055 http header: "Accept-Encoding:
gzip, deflate"
2017/01/05 15:18:44 [debug] 1566#1566: epoll add event: fd:6 op:1
ev:00002001
2017/01/05 15:18:44 [debug] 1566#1566: epoll add event: fd:8 op:1
ev:00002001
2017/01/05 15:18:44 [debug] 1565#1565: epoll del event: fd:6 op:2
ev:00000000
2017/01/05 15:18:44 [debug] 1565#1565: epoll del event: fd:8 op:2
ev:00000000
Вроде все работает, как и должно. Системные лимиты увеличил\снял:
root at thumborsrv:~# ulimit -n
64000
Добавил в /etc/sysctl.conf:
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
Параметры единственного виртуалхоста, который задействован на сервере:
upstream thumbor {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
keepalive 512;
}
server {
listen 80;
listen 443;
server_name img.server.com;
keepalive_timeout 10;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains;
preload";
add_header X-Frame-Options "DENY";
ssl_session_cache builtin:1000 shared:SSL:10m;
# block if specific token in header is not there for port 80
# but allow requests from port 8080
set $block_by_header 0;
if ($server_port = '80') {
set $block_by_header 1;
}
set $header_ok 0;
if ($http_x_cf_secret = 'd41d8cd-98f00b2-04e980099-8ecf8427e') {
set $header_ok 1;
}
set $block_key $block_by_header$header_ok;
if ($block_key = "10") {
return 418;
}
client_max_body_size 50M;
error_log /var/log/nginx/thumbor-error.log;
# SSL certificates to use on secure connections
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_certificate /etc/nginx/ssl/img.server.com.crt;
ssl_certificate_key /etc/nginx/ssl/img.server.com.key;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_prefer_server_ciphers on;
# Forward requests to thumbor.
location / {
proxy_pass http://thumbor;
proxy_read_timeout 300;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
}
}
В логе самой тулзы вижу следующее:
[error] 1189#1189: *24 no live upstreams while connecting to upstream,
client: 41.182.178.150
И таких ошибок много. Помогите пожалуйста найти корень проблемы и устранить
его.
Posted at Nginx Forum: https://forum.nginx.org/read.php?21,271840,271840#msg-271840
Подробная информация о списке рассылки nginx-ru