-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
type: bugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
下游服务通过容器部署,目前只部署了一个节点。shenyu 通过 nacos 发现下游业务服务。当下游服务重启后,此服务旧的 IP 会覆盖新的 IP,导致通过 shenyu 使用 https 协议调用下游服务的 api 时报错:"Can not find healthy upstream url, please check your configuration!"
下游服务重启后,bootstrap 收到的 websocket 日志如下:
2025-09-08 11:36:48 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"id":"1965016462289838080","dateCreated":"2025-09-08 11:36:47","dateUpdated":"2025-09-08 11:36:47","discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.133:8001","status":0,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
2025-09-08 11:36:53 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.65:8001","status":1,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
2025-09-08 11:39:26 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"id":"1965017125572878336","dateCreated":"2025-09-08 11:39:25","dateUpdated":"2025-09-08 11:39:25","discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.65:8001","status":0,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
2025-09-08 11:39:29 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.133:8001","status":1,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
WebSocket 推送的情况:
11:36:48 → 推送了 172.22.104.133:8001,status=0
11:36:53 → 推送了 172.22.104.65:8001,status=1 ✅
11:39:26 → 又推送了 172.22.104.65:8001,status=0
11:39:29 → 又推送了 172.22.104.133:8001,status=1 ✅
实际上 172.22.104.65 才是服务的最新IP,而 172.22.104.133 是服务的旧 IP。
但 shenyu-admin 中展示的是正确的:
Expected Behavior
服务重新部署后,shenyu-bootstrap 能正确识别最新的ip,在后续的调用中能够正常调通。
Steps To Reproduce
- 业务服务启动完成
- 启动 shenyu-admin 完成
- 启动 shenyu-bootstrap 完成
- 配置Divide 的 Selector 和 rule,通过 nacos 发现下游服务
- 测试调用下游服务成功
- 重新部署下游服务完成
- 再次通过网关调用下游服务报错:"Can not find healthy upstream url, please check your configuration!"
Environment
ShenYu version(s):2.7.0.2Debug logs
完成上下游日志:
2025-09-08 11:36:36 [shenyu-netty-epoll-8] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide selector success match , selector name :server-order
2025-09-08 11:36:36 [shenyu-netty-epoll-8] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide rule match path from default strategy
2025-09-08 11:36:36 [shenyu-netty-epoll-8] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide rule success match , rule name :server-order
2025-09-08 11:36:48 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"id":"1965016462289838080","dateCreated":"2025-09-08 11:36:47","dateUpdated":"2025-09-08 11:36:47","discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.133:8001","status":0,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
2025-09-08 11:36:53 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.65:8001","status":1,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
2025-09-08 11:39:26 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"id":"1965017125572878336","dateCreated":"2025-09-08 11:39:25","dateUpdated":"2025-09-08 11:39:25","discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.65:8001","status":0,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
2025-09-08 11:39:29 [WebSocketConnectReadThread-31] INFO org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - server [ws://localhost:9095/websocket] handleResult({"groupType":"DISCOVER_UPSTREAM","eventType":"UPDATE","data":[{"selectorId":"1964881053955350528","pluginName":"divide","selectorName":"server-order","upstreamDataList":[{"discoveryHandlerId":"1964881055377219584","protocol":"http://","url":"172.22.104.133:8001","status":1,"weight":1,"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}],"namespaceId":"649330b6-c2d7-4edc-be8e-8a54df9eb385"}]})
2025-09-08 11:39:55 [shenyu-netty-epoll-9] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - customSign selector match success from default strategy
2025-09-08 11:39:55 [shenyu-netty-epoll-9] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - customSign selector success match , selector name :custom-server-order
2025-09-08 11:39:55 [shenyu-netty-epoll-9] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - customSign rule match path from default strategy
Anything else?
以上问题在服务重新部署(容器滚动更新)的场景下是必现。但单个容器直接重启(停机更新)的场景下不能复现。
Metadata
Metadata
Assignees
Labels
type: bugSomething isn't workingSomething isn't working