Elixir Phoenix - Connection Tracking Reset by Peer Error
I have a very highly competitive Phoenix application running and I notice that in about 10% of requests I get an error readv() failed (104: Connection reset by peer) while reading upstream
in the nginx error files. I added a log statement to the beginning of my first plug-in to print incoming requests, but I can't see how the requests come in. I cannot figure out why I am getting this error and how to debug it.
Attached copy of my nginx config file:
worker_processes 4;
user nginx nginx;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex on; # "on" if nginx worker_processes > 1
use epoll; # enable for Linux 2.6+
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml application/json;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffers 8 64k;
proxy_buffer_size 128k;
large_client_header_buffers 4 16k;
upstream nolen {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name _;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
try_files $uri @proxy;
}
location @proxy {
proxy_redirect off;
proxy_pass http://nolen;
}
}
server {
listen 443 ssl;
server_name _;
ssl_certificate /etc/ssl/selfsigned.crt;
ssl_certificate_key /etc/ssl/selfsigned.key;
ssl_ciphers HIGH:MEDIUM:!aNULL:!ADH:!DH:!EDH:!CAMELLIA:!KRB5:!IDEA:!EXP:!eNULL:!LOW:RC4+RSA:+HIGH:+MEDIUM;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log /var/log/nginx/ssl.access.log;
error_log /var/log/nginx/ssl.error.log;
location / {
try_files $uri @proxy;
}
location @proxy {
proxy_redirect off;
proxy_pass http://nolen;
}
}
include /etc/nginx/conf.d/cloudflare.conf;
}
I notice an error for both urls that accept different request parameters, and serving static js files that can be confirmed to work fine.
Can anyone help me in the process of debugging this issue? Thank.
+3
source to share