How to resolve timeout error while executing transactions in hyperledger fabric? - hyperledger-fabric

I'm trying to insert bulk data in to blockchain. For 11,000 records records the insert is happening without any fault. But if I try to insert more, Im getting the following error.
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: Error executing chaincode: Failed to execute transaction (Timeout expired while executing transaction)
Im using fabric sdk. My fabric verion is 1.2. Can anybody say how to resolve this?

Try to increase the timeout the timeout value. If this dont work, check the chaincode container logs.
Nodejs SDK example

Related

Chaincode Query Transcation is not executing in EC2 Insance

please find the image first intsertion was happened sucessfully.I am trying to query my transaction in Amazon-EC2 but it is returning NULL with endorsement failure even though my insertion transaction is working fine in the local system.
This is the error I get:
endorsement failure during invoke. response: status:500 message:"transaction returned with failure: Error: {\"Error\":\"candidate does not exist with: 13VV1A0533\"}"
From the error it seems that the chaincode is missing error handling for scheduleInterview method.
What the error means is that there is no data for the key candidate id.
Do revert if this doesnt help.

Timeout expired while querying large data on Hyperledger Fabric 1.4.1

I am using Hyperledger Fabric 1.4.1, with Kafka ordering service, Couch DB as stateDB, Java chaincode and Java SDK.
I experience timeout expired when I try to send large data to the channel and then query it back.
The data size of the transaction I sent is 512KB, and I can query it from peers.
I tried sending it 7 times with the same id, and I can get all 7 histories with shim function getHistoryForKey. But when I sent it 8 times with the same id, getHistoryForKey failed.
The error message is shown below (from peers):
Error: endorsement failure during query. response: status:500 message:"failed to execute transaction fdfbc5b72efd688136c777f5b114a3cedc62339e42f6c39a27e86ca11b8e3d14: error sending: timeout expired while executing transaction"
I have tried to expand the timeout with following options and their combinations in peer and client:
CORE_CHAINCODE_EXECUTETIMEOUT="120s"
CORE_LEDGER_STATE_COUCHDBCONFIG_REQUESTTIMEOUT="120s"
# (seems this setting is not for Hyperledger Fabric)
CORE_PEER_GRPCOPTIONS_REQUESET_TIMEOUT="120s"
But they didn't help in my case.
I also noticed that the 7 copies of testing data are about 3.5MB, and I tried to query 4MB data (which is about 8 copies) from a peer but failed.
When we check the chaincode runtime docker, we see the following error message:
SEVERE: An error occured on the chaincode stream. Shutting down the chaincode stream.
io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED:
io.grpc.netty.NettyClientTransport$3: Frame size 6294852 exceeds maximum: 4194304.
It seems like there is a grpc limitation on running the java chaincode docker.
We tested with go chaincode, we do not experience the same issue.
We managed to fix that by overriding the ChaincodeBase class
ManagedChannelBuilder<?> newChannelBuilder() throws IOException {
final NettyChannelBuilder builder = NettyChannelBuilder.forAddress(host, port);
logger.info("Configuring channel connection to peer.");
builder.maxInboundMessageSize(104857600);
logger.info("maxInboundMessageSize is 104857600.");
if (tlsEnabled) {
builder.negotiationType(NegotiationType.TLS);
builder.sslContext(createSSLContext());
} else {
builder.usePlaintext(true);
}
return builder;
}
I have submitted a ticket on fabric Jira to support changing the variable without overriding.

Error: Failed to connect before the deadline when firing transactions at high rate

I am trying to perform performance testing on Hyperledger Fabric v1.2. Network is setup, using fabcar chaincode. Transactions arrival rate in 50 RPS. Using Node JS application to accept transaction requests. Transactions perform putState operation, by adding new variable in the ledger, using this code.
Consensus Used: Solo
Number of Nodes: 4 (orderer and all peers are on
different virtual machines)
Ledger: CouchDB
At lower RPS (0-20), all the transactions are successfully passing. On increasing the transaction arrival rate to 50, around 50% of total transactions fail with the error
Transaction proposal was good
Successfully sent Proposal and received ProposalResponse: Status - 200, message - ""
error: [Remote.js]: Error: Failed to connect before the deadline
error: [Orderer.js]: Orderer grpc://x.x.x.x:7050 has an error Error: Failed to connect before the deadline
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error:
Failed to connect before the deadline
What does this error mean actually? Why is the client unable to send endorsed transaction to the orderer?
And around 20% of them failed with the following error
Send transaction promise and event listener promise have completed in 30086 ms
Successfully sent transaction to the orderer.
Transaction failed to be committed to the ledger due to ::TIMEOUT
As per different research papers, Hyperledger Fabric must be able to process requests at rates as high as 2000, why is it giving such results?
I had faced the same problem by using the invoke code from fabric-samples repository. I fixed the issue by changing the order of promise chaining.
What I did was as follows:
return checkUser(this.user)
.then(() => return channel.sendTransactionProposal(request))
.then((results) => checkPrposal(results))
.then((results) => submitTrasaction(results))
.then(() => connectEventHub())

Timeout while deploying nodejs based chaincode

I am getting the below error while trying to deploy any nodejs based chaincode on hyperledger 1.4 network :
Error: could not assemble transaction, err proposal response was not
successful, error code 500, msg timeout expired while starting
chaincode
I have even tried the base example chaincode_example02, that is also giving the same error.
Please help.

Using a hyper ledger network without tls causing timeout when invoking a chaincode

I am getting the below error when I invoke my smart contract
Error: Error endorsing invoke: rpc error: code = Unknown desc = Error
executing chaincode: Failed to execute transaction (Timeout expired while
executing transaction) - <nil>
I am able to query the chaincode and this chaincode has worked on networks with TLS but now without it Im getting the error.
We removed TLS as we were having troubles with grpc connections when making calls from the node SDK. So possibly we could hit two birds with one stone.
How to deal with this error above?
And how to deal with TLS in the node app when making GRPC calls.

Resources