链码事件侦听器不会在对等节点 killed/restarted 之后再次连接到对等节点
chaincode event listener wont connect again to peers after peer nodes killed/restarted
我的基于 fabric-node-sdk 的应用程序正在使用 network.getContract(smartContractName).addContractListener
侦听链码事件。当我杀死所有对等节点时,它会打印以下日志,断开事件侦听器,并且从不尝试
2021-08-24T07:22:26.056Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Eventer- name: peer1.org1.com, url:grpcs://peer1.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:26.057Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org1.com url:grpcs://peer1.org1.com:7051 timeout:3000
2021-08-24T07:22:26.057Z - error: [Eventer]: ServiceEndpoint grpcs://peer1.org1.com:7051 reset connection failed :: Error: Failed to connect before the deadline on Eventer- name: peer1.org1.com, url:grpcs://peer1.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:29.057Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Eventer- name: peer0.org1.com, url:grpcs://peer0.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:29.058Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.com url:grpcs://peer0.org1.com:7051 timeout:3000
2021-08-24T07:22:29.058Z - error: [Eventer]: ServiceEndpoint grpcs://peer0.org1.com:7051 reset connection failed :: Error: Failed to connect before the deadline on Eventer- name: peer0.org1.com, url:grpcs://peer0.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:29.059Z - error: [EventService]: send[peer1.org1.com,peer0.org1.com] - #3 - no targets started - Error: Event service peer0.org1.com is not connected
at EventService.send (/home/ubuntu/rest-client/node_modules/fabric-common/lib/EventService.js:368:20)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async EventServiceManager.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/eventservicemanager.js:50:9)
at async BlockEventSource.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:100:9)
at async BlockEventSource.start (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:64:13)
2021-08-24T07:22:29.059Z - error: [BlockEventSource]: Failed to start event service message=Event service peer0.org1.com is not connected, stack=Error: Event service peer0.org1.com is not connected
at EventService.send (/home/ubuntu/rest-client/node_modules/fabric-common/lib/EventService.js:368:20)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async EventServiceManager.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/eventservicemanager.js:50:9)
at async BlockEventSource.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:100:9)
at async BlockEventSource.start (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:64:13)
它不会抛出任何我可以捕获并以可以继续尝试连接到对等方的方式处理它的错误。有办法处理吗?
除此之外,我还可以在日志中看到它尝试连接到其他对等点 grpcs://peer1.org1.com:7051 timeout:3000
并在 3000 毫秒后超时。无论如何增加这个超时?该应用程序侦听大量事件并将状态保存在 postgres 数据库中,这对产品至关重要。
这是此 Jira 中报告的问题:https://jira.hyperledger.org/browse/FABN-1657
它应该在标记为 unstable-2.2
的当前 npm 包中以及即将发布的 Node SDK v2.2.9 版本中得到修复。
我的基于 fabric-node-sdk 的应用程序正在使用 network.getContract(smartContractName).addContractListener
侦听链码事件。当我杀死所有对等节点时,它会打印以下日志,断开事件侦听器,并且从不尝试
2021-08-24T07:22:26.056Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Eventer- name: peer1.org1.com, url:grpcs://peer1.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:26.057Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org1.com url:grpcs://peer1.org1.com:7051 timeout:3000
2021-08-24T07:22:26.057Z - error: [Eventer]: ServiceEndpoint grpcs://peer1.org1.com:7051 reset connection failed :: Error: Failed to connect before the deadline on Eventer- name: peer1.org1.com, url:grpcs://peer1.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:29.057Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Eventer- name: peer0.org1.com, url:grpcs://peer0.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:29.058Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.com url:grpcs://peer0.org1.com:7051 timeout:3000
2021-08-24T07:22:29.058Z - error: [Eventer]: ServiceEndpoint grpcs://peer0.org1.com:7051 reset connection failed :: Error: Failed to connect before the deadline on Eventer- name: peer0.org1.com, url:grpcs://peer0.org1.com:7051, connected:false, connectAttempted:true
2021-08-24T07:22:29.059Z - error: [EventService]: send[peer1.org1.com,peer0.org1.com] - #3 - no targets started - Error: Event service peer0.org1.com is not connected
at EventService.send (/home/ubuntu/rest-client/node_modules/fabric-common/lib/EventService.js:368:20)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async EventServiceManager.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/eventservicemanager.js:50:9)
at async BlockEventSource.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:100:9)
at async BlockEventSource.start (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:64:13)
2021-08-24T07:22:29.059Z - error: [BlockEventSource]: Failed to start event service message=Event service peer0.org1.com is not connected, stack=Error: Event service peer0.org1.com is not connected
at EventService.send (/home/ubuntu/rest-client/node_modules/fabric-common/lib/EventService.js:368:20)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async EventServiceManager.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/eventservicemanager.js:50:9)
at async BlockEventSource.startEventService (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:100:9)
at async BlockEventSource.start (/home/ubuntu/rest-client/node_modules/fabric-network/lib/impl/event/blockeventsource.js:64:13)
它不会抛出任何我可以捕获并以可以继续尝试连接到对等方的方式处理它的错误。有办法处理吗?
除此之外,我还可以在日志中看到它尝试连接到其他对等点 grpcs://peer1.org1.com:7051 timeout:3000
并在 3000 毫秒后超时。无论如何增加这个超时?该应用程序侦听大量事件并将状态保存在 postgres 数据库中,这对产品至关重要。
这是此 Jira 中报告的问题:https://jira.hyperledger.org/browse/FABN-1657
它应该在标记为 unstable-2.2
的当前 npm 包中以及即将发布的 Node SDK v2.2.9 版本中得到修复。