hyperledger / fabric-gateway

Go, Node and Java client API for Hyperledger Fabric v2.4+
https://hyperledger.github.io/fabric-gateway/
Apache License 2.0
154 stars 91 forks source link

Recommendation for more logging or details for submit error scenarios #280

Closed davidkel closed 2 years ago

davidkel commented 3 years ago

When attempting to submit a transaction where we know the environment is not in a good state and thus errors are expected, the following 3 types of errors were received

14 UNAVAILABLE: failed to select a set of endorsers that satisfy the endorsement policy
14 UNAVAILABLE: no combination of peers can be derived which satisfy the endorsement policy: no peer combination can satisfy the endorsement policy Details

and

10 ABORTED: failed to collect enough transaction endorsements, see attached details for more info Details: [{\"address\":\"peer0.org2.example.com:9051\",\"message\":\"error 500, error in simulation: failed to execute transaction 389b63174fda3704ffb89424f4a469c6ff594b7c5b17fcdc3dbd9d0d1f9bc955: error sending: chaincode stream terminated\",\"mspId\":\"Org2MSP\"},{\"address\":\"peer1.org3.example.com:11151\",\"message\":\"error 500, error in simulation: failed to execute transaction 389b63174fda3704ffb89424f4a469c6ff594b7c5b17fcdc3dbd9d0d1f9bc955: error sending: chaincode stream terminated\",\"mspId\":\"Org3MSP\"}]"}

The last one includes details looks to provide additional clues into why the error message occurs whereas the first 2 don't, so you would need to look in the gateway peer logs to try to see what the true cause of these error messages are.

the log does show connectivity problems which could be the cause of the message

So this issue is about having a discussion on if it's possible to include more detail back to the client about the true cause or whether there is a need for logging in the gateway to help determine if the connectivity errors seen further up in the log are the contributors to the error message.

andrew-coleman commented 3 years ago

The first one:

14 UNAVAILABLE: failed to select a set of endorsers that satisfy the endorsement policy

gets generated if discovery believes one or more peers are available, but the gateway fails to connect to it/them. So this one I could definitely append the list of endpoints that failed to connect.

The second one:

14 UNAVAILABLE: no combination of peers can be derived which satisfy the endorsement policy: ...

gets generated by the discovery service. It will only include a peer in an endorsement plan if it believes that peer is alive. And it gets that information from periodic gossip messages. Whether you get this error, or the previous one, is probably just down to timing relative to the gossip messages. The gateway doesn't have much it can add to the error message for this case.

andrew-coleman commented 2 years ago

resolved