hyperledger / fabric-sdk-java

https://wiki.hyperledger.org/display/fabric
Apache License 2.0
1.12k stars 708 forks source link

Getting block time exceeded 5 seconds for channel mychannel when peer join channel #156

Closed Xugcs closed 2 years ago

Xugcs commented 2 years ago

newChannel.joinPeer(peer, createPeerOptions().setPeerRoles(EnumSet.of(Peer.PeerRole.ENDORSING_PEER, Peer.PeerRole.LEDGER_QUERY, Peer.PeerRole.CHAINCODE_QUERY, Peer.PeerRole.EVENT_SOURCE))); 17:02:00.735 [main] ERROR o.h.f.sdk.Channel - [joinPeer,896] - Channel{id: 2, name: mychannel} removing peer Peer{ id: 3, name: peer0.org1.example.com, channelName: null, url: grpcs://172.22.110.75:7051} due to exception Getting block time exceeded 5 seconds for channel mychannel 17:02:00.735 [main] ERROR o.h.f.sdk.Channel - [joinPeer,899] - org.hyperledger.fabric.sdk.exception.TransactionException: Getting block time exceeded 5 seconds for channel mychannel Exception in thread "main" org.hyperledger.fabric.sdk.exception.ProposalException: Getting block time exceeded 5 seconds for channel mychannel at org.hyperledger.fabric.sdk.Channel.joinPeer(Channel.java:900) at org.hyperledger.fabric.sdk.Channel.joinPeer(Channel.java:817) at com.ruoyi.fabric.FrabricSdk.constructChannel(FrabricSdk.java:137) at com.ruoyi.fabric.FrabricSdk.main(FrabricSdk.java:190) Caused by: org.hyperledger.fabric.sdk.exception.TransactionException: Getting block time exceeded 5 seconds for channel mychannel at org.hyperledger.fabric.sdk.Channel.seekBlock(Channel.java:2691) at org.hyperledger.fabric.sdk.Channel.getGenesisBlock(Channel.java:1855) at org.hyperledger.fabric.sdk.Channel.joinPeer(Channel.java:859) ... 3 more

bestbeforetoday commented 2 years ago

It seems that your orderer is taking a long time to supply the genesis block. Possibly the orderer or network connection is slow or unavailable?

You should be able to increase the timeout with the org.hyperledger.fabric.sdk.channel.genesisblock_wait_time configuration property. Or you could use the CLI to perform this admin operation:

https://hyperledger-fabric.readthedocs.io/en/release-2.2/commands/peerchannel.html

bestbeforetoday commented 2 years ago

Closing as this has been stale for a while, so assume the issue is resolved.

zyDevoted commented 1 year ago

It seems that your orderer is taking a long time to supply the genesis block. Possibly the orderer or network connection is slow or unavailable?

You should be able to increase the timeout with the org.hyperledger.fabric.sdk.channel.genesisblock_wait_time configuration property. Or you could use the CLI to perform this admin operation:

https://hyperledger-fabric.readthedocs.io/en/release-2.2/commands/peerchannel.html

I got the same error. But how to change genesisblock_wait_time in fabric-sdk-java 2.2.21(Maven) . I can't find the related api.

bestbeforetoday commented 1 year ago

Config properties like org.hyperledger.fabric.sdk.channel.genesisblock_wait_time should be settable using a config file or with capitalised environment variables, for example ORG_HYPERLEDGER_FABRIC_SDK_CHANNEL_GENESISBLOCK_WAIT_TIME. See the README for details.