UDP Connection refused

Maxim Dounin mdounin на mdounin.ru
Чт Мар 12 12:34:03 UTC 2020


Hello!

On Thu, Mar 12, 2020 at 02:32:23AM -0400, inkognito0609 wrote:

> При отправке логов через syslog (udp) проскакивают ошибки 111 Connection
> refused, что непонятно при отправке логов по udp, так как этот протокол не
> подразумевает установки соединения в принципе.
> 
> strace дает следующее:
> 30752 sendto(64, "<190>Mar 12 09:45:59 balancer nginx: { \"timestamp\":
> \"2020-03-12T09:45:59+05:00\", \"remote_addr\": \"91.144.134.5\",
> \"body_bytes_sent\": 18686, \"request_time\": 0.000, \"response_status\":
> 200, \"request\": \"GET /themes/default/images/flags.png HTTP/1.0\",
> \"request_method\": \"GET\", \"host\":
> \"chel.wifi.example.ru\",\"upstream_cache_status\":
> \"HIT\",\"upstream_addr\": \"\",\"http_x_forwarded_for\":
> \"10.12.199.134\",\"http_referrer\":
> \"https://chel.wifi.domru.ru/index.php?request_uri=http://captive.apple.com/hotspot-detect.html\",
> \"upstream_response_time\": \"\",\"upstream_header_time\":
> \"\",\"upstream_connect_time\": \"\",\"http_user_agent\": \"Mozilla/5.0
> (Macintosh; Intel Mac OS X 10_14) AppleWebKit/605.1.15 (KHTML, like
> Gecko)\",\"x-project\": \"\",\"cluster\": \"1\",\"container_id\":
> \"\",\"citydomain\": \"\" }", 765, 0, NULL, 0) = -1 ECONNREFUSED (Connection
> refused)

Да, так бывает.

Цитируя "Programming UNIX Sockets in C - Frequently Asked 
Questions", AKA Socket FAQ 
(http://web.deu.edu.tr/doc/soket/#faq57):

: If the target machine discards the message because there is no 
: process reading on the requested port number, it sends an ICMP 
: message to your machine which will cause the next system call on 
: the socket to return ECONNREFUSED. Since delivery of ICMP messages 
: is not guarenteed you may not recieve this notification on the 
: first transaction.

То есть ошибка ожидаема, и она означает, что на предыдущее 
сообщение в syslog прилетело ICMP-сообщение в ответ.

Если вы не в курсе, что у вас часть UDP-сообщений где-то 
реджектится - это повод разобраться, где и почему.  Если в курсе - 
это лишнее напоминание, что оно так.

-- 
Maxim Dounin
http://mdounin.ru/


Подробная информация о списке рассылки nginx-ru