hi, all
最近openresty出现死循环,死在get upstream peer上,也发现一个奇怪的问题,在设置了proxy_next_upstream off 之后,upstream还是会尝试将请求转发到其它服务器,下面是死循环打印的调用栈
#0 0x00000000004bb91c in ngx_http_upstream_get_consistent_hash_peer (pc=0x5943bc8,
data="" optimized out>)
at /data0/workshop/tools/ngx_http_consistent_hash-0b75d6d/ngx_http_upstream_consistent_hash_module.c:170
#1 0x0000000000479066 in ngx_http_upstream_get_keepalive_peer (pc=0x57eee20,
data="" optimized out>) at src/http/modules/ngx_http_upstream_keepalive_module.c:227
#2 0x000000000042d552 in ngx_event_connect_peer (pc=0x57eee20) at src/event/ngx_event_connect.c:25#3 0x0000000000451586 in ngx_http_upstream_connect (r=0x67cc018, u=0x5943bb8)
at src/http/ngx_http_upstream.c:1121
#4 0x0000000000451c11 in ngx_http_upstream_next (r=0x67cc018, u=0x5943bb8, ft_type=2)
at src/http/ngx_http_upstream.c:2953
#5 0x0000000000451e45 in ngx_http_upstream_process_header (r=0x67cc018, u=0x5943bb8)
at src/http/ngx_http_upstream.c:1582
#6 0x0000000000451455 in ngx_http_upstream_send_request (r=0x67cc018, u=0x5943bb8)
at src/http/ngx_http_upstream.c:1449
#7 0x0000000000451a21 in ngx_http_upstream_connect (r=0x67cc018, u=0x5943bb8)
at src/http/ngx_http_upstream.c:1234
#8 0x0000000000451c11 in ngx_http_upstream_next (r=0x67cc018, u=0x5943bb8, ft_type=2)
at src/http/ngx_http_upstream.c:2953
#9 0x0000000000451e45 in ngx_http_upstream_process_header (r=0x67cc018, u=0x5943bb8)
at src/http/ngx_http_upstream.c:1582
#10 0x0000000000451455 in ngx_http_upstream_send_request (r=0x67cc018, u=0x5943bb8)
at src/http/ngx_http_upstream.c:1449
#11 0x0000000000451a21 in ngx_http_upstream_connect (r=0x67cc018, u=0x5943bb8) at src/http/ngx_http_upstream.c:1234
#12 0x0000000000453408 in ngx_http_upstream_init_request (r=0x67cc018)
at src/http/ngx_http_upstream.c:645
#13 0x00000000004534ca in ngx_http_upstream_init (r=0x67cc018) at src/http/ngx_http_upstream.c:446
有几个问题:
1、我的理解是红色部分应该就是失败之后重新尝试连其它服务器的过程,是这样的吗?
2、很奇怪的是蓝色部分的 pc 参数居然不一样,这是为什么呢
ps:openresty版本为1.2.3.8 ,consistent_hash 模块使用的是
https://github.com/sduwangning/ngx_http_consistent_hash 这个代码
其中upstream 配置如下
upstream sampleurl {
consistent_hash $hash_str;
server 10.77.6.77:8080;
server 10.77.6.78:8080;
server 10.77.6.82:8080;
server 10.77.6.83:8080;
keepalive 10;
}
死循环问题出现过几次了,重启服务后会正常运行
找了几天原因未果,望各位大牛能给我点提示信息,应该从哪里入手找这个原因