服务器重启后nodejs grpc-js重新连接

vfh0ocws  于 11个月前  发布在  Node.js
关注(0)|答案(1)|浏览(94)

我在重新连接@grpc/grpc-js客户端时遇到了一些奇怪的行为
一旦客户端连接成功,服务器重新启动,客户端在连接状态下保持循环
当服务器掉线时,我应该如何处理重新连接?
谢谢你的帮助
客户端调试:

D 2023-11-16T17:23:49.137Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.unref | configSelectionQueue.length=0 pickQueue.length=0
D 2023-11-16T17:23:49.137Z | v1.9.10 67824 | load_balancing_call | [30] Pick called
D 2023-11-16T17:23:49.137Z | v1.9.10 67824 | load_balancing_call | [30] Pick result: QUEUE subchannel: null status: undefined undefined
D 2023-11-16T17:23:49.137Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.ref | configSelectionQueue.length=0 pickQueue.length=1
D 2023-11-16T17:23:49.137Z | v1.9.10 67824 | connectivity_state | (1) dns:10.10.10.10:50051 CONNECTING -> IDLE
D 2023-11-16T17:23:49.137Z | v1.9.10 67824 | resolving_load_balancer | dns:10.10.10.10:50051 IDLE -> CONNECTING
D 2023-11-16T17:23:49.137Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.unref | configSelectionQueue.length=0 pickQueue.length=0
D 2023-11-16T17:23:49.138Z | v1.9.10 67824 | load_balancing_call | [30] Pick called
D 2023-11-16T17:23:49.138Z | v1.9.10 67824 | load_balancing_call | [30] Pick result: QUEUE subchannel: null status: undefined undefined
D 2023-11-16T17:23:49.138Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.ref | configSelectionQueue.length=0 pickQueue.length=1
D 2023-11-16T17:23:49.138Z | v1.9.10 67824 | connectivity_state | (1) dns:10.10.10.10:50051 IDLE -> CONNECTING
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | resolving_load_balancer | dns:10.10.10.10:50051 CONNECTING -> IDLE
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.unref | configSelectionQueue.length=0 pickQueue.length=0
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | load_balancing_call | [30] Pick called
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | load_balancing_call | [30] Pick result: QUEUE subchannel: null status: undefined undefined
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.ref | configSelectionQueue.length=0 pickQueue.length=1
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | connectivity_state | (1) dns:10.10.10.10:50051 CONNECTING -> IDLE
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | resolving_load_balancer | dns:10.10.10.10:50051 IDLE -> CONNECTING
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.unref | configSelectionQueue.length=0 pickQueue.length=0
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | load_balancing_call | [30] Pick called
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | load_balancing_call | [30] Pick result: QUEUE subchannel: null status: undefined undefined
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | channel | (1) dns:10.10.10.10:50051 callRefTimer.ref | configSelectionQueue.length=0 pickQueue.length=1
D 2023-11-16T17:23:50.140Z | v1.9.10 67824 | connectivity_state | (1) dns:10.10.10.10:50051 IDLE -> CONNECTING

字符串
在我的服务器端,我什么也没有收到。我使用了tcpdump,没有流量
以下是我的客户端设置:

const client = new Service(url, credentials.createInsecure(), {
          'grpc.max_reconnect_backoff_ms': 1000,
          'grpc.initial_reconnect_backoff_ms': 5000,
          'grpc.keepalive_time_ms': 1000,
          'grpc.keepalive_permit_without_calls': 1,
          'grpc.keepalive_timeout_ms': 500,
          'grpc.max_send_message_length': 1024 * 1024 * 25,
          'grpc.max_receive_message_length': 1024 * 1024 * 25,
        });

piah890a

piah890a1#

这是grpc-js库中的一个bug,已经在1.9.11版本中修复。

相关问题