Hyperledger fabric Hyperledger结构:向对等方发送建议时超时

Hyperledger fabric Hyperledger结构:向对等方发送建议时超时,hyperledger-fabric,Hyperledger Fabric,在使用fabric gateway java时,fabric 1.4存在问题。有时,它在向对等方发送建议时抛出TimeoutException。在大多数情况下,它运行良好。有人能帮忙吗?谢谢 这是错误日志 2020-09-03 10:02:34,202 [ERROR]--org.hyperledger.fabric.sdk.Channel 4451 -- Channel Channel{id:1,name: mychannel} sending proposal with transactio

在使用fabric gateway java时,fabric 1.4存在问题。有时,它在向对等方发送建议时抛出TimeoutException。在大多数情况下,它运行良好。有人能帮忙吗?谢谢 这是错误日志

2020-09-03 10:02:34,202 [ERROR]--org.hyperledger.fabric.sdk.Channel 4451 -- Channel 
Channel{id:1,name: mychannel} sending proposal with transaction
e1d7313d8f8fc09fbae9a3ac2027bbf33ba3714c028a609f26380a4b0810466e to 
Peer{ id: 6, name: peer1.org1.example.com, channelName: mychannel, 
url:grpcs://192.168.1.1:7051, mspid: Org1MSP} failed because of 
timeout(35000 milliseconds) expiration
java.util.concurrent.TimeoutException: null
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:432)
        at org.hyperledger.fabric.sdk.Channel.sendProposalToPeers(Channel.java:4434)
        at org.hyperledger.fabric.sdk.Channel.sendProposal(Channel.java:4358)
        at org.hyperledger.fabric.sdk.Channel.sendTransactionProposal(Channel.java:3908)

事实上,我没有任何直接的解决办法,但我试图帮助你

问题发生在“fabric sdk java”中,而不是“fabric gateway java”。 更具体地说:

catch (TimeoutException e) {
            message = format("Channel %s sending proposal with transaction %s to %s failed because of timeout(%d milliseconds) expiration",
                    toString(), txID, peerName, transactionContext.getProposalWaitTime());
            logger.error(message, e);
        } 
链接:

对于“fabric sdk java”,您可以遵循以下步骤:

您可以增加setProposalWaitTime

setProposalWaitTime

public void setProposalWaitTime(long proposalWaitTime)

Sets the timeout for a single proposal request to endorser in milliseconds.

Parameters:
    proposalWaitTime - the timeout for a single proposal request to endorser in milliseconds
链接:

因此,您的代码可能如下所示:

        TransactionProposalRequest request = fabClient.getInstance().newTransactionProposalRequest();
        ChaincodeID ccid = ChaincodeID.newBuilder().setName(Config.CHAINCODE_1_NAME).build();
        request.setChaincodeID(ccid);
        request.setFcn("createCar");
        String[] arguments = { "CAR1", "Chevy", "Volt", "Red", "Nick" };
        request.setArgs(arguments);
        request.setProposalWaitTime(4000);
对于“fabric gateway java”,您可以遵循以下步骤:

TimeoutException—如果事务已成功提交给订购方,但在从对等方收到提交事件之前超时

链接:

因此,您可以增加setCommitTimeout

setCommitTimeout-设置向订购方提交事务后等待接收提交事件的最长时间

事务setCommitTimeout(长超时, 时间单位(时间单位)

参数:

超时-等待的最长时间

timeUnit—超时参数的时间单位

返回: 此事务对象允许方法链接


链接:

谢谢您的回答。但是交易尚未发送给订购方。当我创建交易并发送给背书对等方时,它超时。它发生在Channel.Java类中。(方法是私有集合发送提议者操作者(集合对等方、签名提议签名提议、TransactionContext TransactionContext)抛出InvalidArgumentException、ProposalException)默认超时是35000ms,我认为已经足够了。事实上,我很抱歉,我没有实际的解决方案,问题部分的“fabric gateway java”一行也让我感到困惑。无论如何,谢谢。我正在使用调试日志获取更多信息,但我仍然没有解决它。