Re: Unable to Query data from Hyperledger Fabric #fabric-chaincode #hyperledger-fabric #couchdb


chintanr97@...
 

Hi David, That's correct! However, we found a minor fix in the chaincode and post that the latest error logs give following stack trace:

```

[34m2021-01-12 09:22:03.362 UTC [endorser] callChaincode -> INFO 10f7b [][] Entry chaincode: name:"<ccName>" 

[31m2021-01-12 09:22:41.290 UTC [chaincode] BuildQueryResponse -> ERRO [0m Failed to get query result from iterator

[31m2021-01-12 09:22:41.290 UTC [chaincode] HandleTransaction -> ERRO [0m [] Failed to handle QUERY_STATE_NEXT. error: net/http: request canceled (Client.Timeout exceeded while reading body)

error reading response body

github.com/hyperledger/fabric/core/ledger/util/couchdb.(*CouchDatabase).QueryDocuments

/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/util/couchdb/couchdb.go:1072

github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.(*queryScanner).executeQueryWithBookmark

/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go:483

github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.(*queryScanner).Next

/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go:731

github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr.(*queryResultsItr).Next

/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/helper.go:433

github.com/hyperledger/fabric/core/chaincode.(*QueryResponseGenerator).BuildQueryResponse

/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/query_response_generator.go:32

github.com/hyperledger/fabric/core/chaincode.(*Handler).HandleQueryStateNext

/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/handler.go:824

github.com/hyperledger/fabric/core/chaincode.(*Handler).HandleTransaction

/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/handler.go:276

runtime.goexit

/opt/go/src/runtime/asm_amd64.s:1337

github.com/hyperledger/fabric/core/chaincode.(*Handler).HandleQueryStateNext

/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/handler.go:827

github.com/hyperledger/fabric/core/chaincode.(*Handler).HandleTransaction

/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/handler.go:276

runtime.goexit

/opt/go/src/runtime/asm_amd64.s:1337

QUERY_STATE_NEXT failed: transaction ID: <tid>

github.com/hyperledger/fabric/core/chaincode.(*Handler).HandleTransaction

/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/handler.go:280

runtime.goexit

/opt/go/src/runtime/asm_amd64.s:1337

[34m2021-01-12 09:22:41.291 UTC [<cc>] func2 -> INFO [0m 2021/01/12 09:22:41 error getting results for query response 

[34m2021-01-12 09:22:41.291 UTC [<cc>] func2 -> INFO [0m error: QUERY_STATE_NEXT failed: transaction ID: <tid>: error reading response body: net/http: request canceled (Client.Timeout exceeded while reading body)

[34m2021-01-12 09:22:41.291 UTC [endorser] callChaincode -> INFO [0m [<channel>][] Exit chaincode: name:"<ccName>"  (37928ms)
[31m2021-01-12 09:22:41.300 UTC [endorser] ProcessProposal -> ERRO [0m [<channel>][] simulateProposal() resulted in chaincode name:"<ccName>"  response status 500 for txid: <tid>
```

In the total 4 iterations of query we did, the timestamp in the second last log line, "Exit chaincode: name: ..." was: 49695ms, 55657ms, 37928ms (above) snippet, and 38826ms.

So, I am not sure now if it is "ledger.state.couchDBConfig.requestTimeout" (which has been set to 35 s), or if it is "CORE_CHAINCODE_EXECUTETIMEOUT" (updated to 300s).

Join fabric@lists.hyperledger.org to automatically receive all group messages.