error: [DiscoveryHandler]: compareProposalResponseResults[undefined] - read/writes result sets do not match index=1 #hyperledger-fabric #fabric-endorser #fabric-peer


vemula.harish31@...
 

I get the compareProposalResponseResults[undefined] error when sending multiple transactions concurrently within a particular time duration, using Node SDK,
Sometimes I am getting this error at the client console and sometimes not getting it at all.

there are no errors in peer and orderer logs. all transactions are committed to the ledger.
I am using asset Transfer chain code, invoking createAsset().

while ((Date.now() - startTime) < t) {
        submit(fname);
}

//here submit is an asynchronus function,
// const fname = ['CreateAsset','asset8','red','123',filetext,'123']; 

async function submit(fname) {    
          const response = contract.submitTransaction(...fname);
}

How can I avoid the above error, what exactly causing the issue?


Mark Lewis
 

This means that the simulation of the transaction on different peers yielded different results. Several things could cause this situation, including non-deterministic chaincode implementations, which can be non-obvious factors such as JSON strings being constructed without a well-defined ordering of object properties. I think the most likely cause is that multiple transactions are updating the same ledger keys, so the version of those ledger values is different at different peers depending on the block height of the peer at the point they simulated the transaction.

For example, if two "CreateAsset" transactions are submitted at similar times, both creating an asset with the same ID, you may see inconsistent proposal results as some peers see the ledger state before an asset is created, and other peers see the ledger state after the first "CreateAsset" transaction has been committed.

You might need to be careful with your data model and transaction design, or transaction invocation patterns, to minimise the chance of conflicts. Or include retry code in your application to try transactions again if unavoidable conflicts occur.