Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法正确检查“主机不可达”的UDP服务器的健康状态 #54

Open
lc90 opened this issue Jan 5, 2022 · 1 comment
Open

Comments

@lc90
Copy link

lc90 commented Jan 5, 2022

对于同网段的UDP服务器(不同网段未测试),若服务器关闭或网络断开,健康检查将认为UDP包正常超时,认为该服务器状态正常可用,在ngx_event_connect_peer() 和ngx_stream_upstream_check_peek_one_byte()中都没有捕获到错误。

通过测试将以下代码去注释即可解决以上问题,但不知道最初对其的注释是出于什么原因,去注释后会不会导致什么问题?
/* (changxun): set sock opt "IP_RECVERR" in order to recv icmp error like host/port unreachable. /
/
note: we have invoke 'ngx_event_connect_peer() above. so the code we comment is not required.
int val = 1;
if( setsockopt( c->fd, SOL_IP, IP_RECVERR, &val, sizeof(val) ) == -1 ){
ngx_log_error(NGX_LOG_ERR, event->log, 0,
"setsockopt(IP_RECVERR) failed with peer: %V ",
&peer->check_peer_addr->name);
}
*/

@kingsurprise
Copy link

是否正常收到了ICMP主机不可达报文?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants