英文:
Golang hedera sdk testnet "Client received GoAway with error code ..."
问题
我正在尝试连接到Hedera测试网络。我按照文档创建了一个账户,并使用以下代码片段尝试连接到Hedera网络:
hederaClient := hederaSdk.ClientForTestnet()
hederaClient.SetOperator(cfg.Hedera.OperatorID, cfg.Hedera.OperatorKey)
但是它抛出了一个错误信息:"ERROR: [transport] Client received GoAway with error code ENHANCE_YOUR_CALM and debug data equal to ASCII 'too_many_pings'."
我发现这是一个与gRPC连接相关的问题,但是我只打开了一个连接,并没有更改连接的任何设置。
我的Go版本是1.20,Hedera SDK版本是v2.24.3。
英文:
I am trying to connect to hedera test net. I followed the docs and created a account and used
hederaClient := hederaSdk.ClientForTestnet()
hederaClient.SetOperator(cfg.Hedera.OperatorID, cfg.Hedera.OperatorKey)
This snippet to try and connect to hedera network. But it throws
"ERROR: [transport] Client received GoAway with error code ENHANCE_YOUR_CALM and debug data equal to ASCII "too_many_pings"."
i found out that this is a problem with grpc connection but i am opening only one connection and didn't change any settings in the connection.
my go version is 1.20
and hedera sdk is v2.24.3
答案1
得分: 1
grpc是建立在HTTP/2之上的。在HTTP/2中,你可以在单个连接上有多个交错的并发请求。每个独立的请求被称为一个"流"。Hedera被配置为支持每个连接最多10个并发流(请求)。
限制并发流的主要原因是控制所有连接的总内存使用量。也许Hedera可以提高这个限制,也许不行。无论哪种情况,客户端都必须准备好处理这种情况。
在这种情况下,客户端收到了一个GOAWAY和ENHANCE_YOUR_CALM,因为它试图发送的并发流超过了允许的数量。应该是SDK在处理这个问题时对客户端应用程序进行了透明处理,所以客户端应用程序永远不会遇到这个问题。如果不是这种情况,那么我首先会检查SDK是否有bug。
英文:
For some background, grpc is built on top of HTTP/2. In HTTP/2, you can have multiple interleaved concurrent requests on a single connection. Each of these unique requests is called a "stream". Hedera is configured to support a maximum of 10 concurrent streams (requests) per connection.
The main reason for a limit is to control the total memory usage across all connections. Maybe Hedera can raise the limit, maybe not. In either case, a client has to be prepared to handle the case.
The client in this case got a GOAWAY and ENHANCE_YOUR_CALM because it was trying to send way more concurrent streams than permitted. It should be that the SDKs handle this transparently so the client application doesn't ever encounter this. If that is not the case, then I would first see if the SDK has a bug.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论