Opened 7 years ago

Closed 7 years ago

#1212 closed defect (fixed)

nginx health check for UDP

Reported by: haiyangu@… Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.10.x
Keywords: udp health check Cc:
uname -a: Linux ghy-nginx-3.localdomain 3.10.0-327.10.1.el7.x86_64 #1 SMP Sat Jan 23 04:54:55 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.10.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module --with-http_perl_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-ipv6 --with-http_v2_module --with-http_geoip_module --with-http_image_filter_module --with-debug --with-file-aio --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --with-ld-opt=-Wl,-E --add-module=/home/test/rpmbuild/BUILD/root/nginx_upstream_check_module-master --add-module=/home/test/rpmbuild/BUILD/root/nginx-sticky-module-master

Description

As NGINX description "If an attempt to connect to an upstream server times out or results in an error, NGINX Open Source can mark the server as unavailable and stop sending requests to it for a defined amount of time".

Parameter "fail_timeout" and "max_fails" are designed for this mechanism.

I tested this scenario passed with TCP messages, while failed with UDP.
Here is my nginx.conf file:

stream {
           upstream sippBackend.com {
           hash $remote_addr ;
           server 135.1.238.12:5060 max_fails=3 fail_timeout=30s;
           server 135.1.238.13:5060 max_fails=3 fail_timeout=30s;
           }

           server {
           listen 5060 udp;
           proxy_pass test123.com;
           proxy_timeout 1s;
#          proxy_responses 1;
           }
}

The udp message from client is routed to 135.1.238.13 originally. After a while, I close the listen port 5060 of this server. The load balancer always attempts to route to this server not for 3 times. Thus directs to fail traffic then.

For TCP case, I can see that messages are routed to the other server 135.1.238.12 until the previous 135.1.238.13 up. So it seems this health check method does not work for UDP hash. I wonder that whether this server will be marked as unavailable when using hash or consistent hash for UDP routing?

Attachments (1)

testHashUDP.cap (113.4 KB ) - added by haiyangu@… 7 years ago.
Packet when routing UDP messages with hash method

Download all attachments as: .zip

Change History (4)

by haiyangu@…, 7 years ago

Attachment: testHashUDP.cap added

Packet when routing UDP messages with hash method

comment:1 by Roman Arutyunyan, 7 years ago

Can you post the debug log?

comment:2 by Ruslan Ermilov, 7 years ago

This apparently has been fixed in 1.11.7 (http://hg.nginx.org/nginx/rev/75dbab4ea930)

comment:3 by Ruslan Ermilov, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.