java fixed asset implementation doesn't work with the rich query or range query workloads
davidkel opened this issue · 1 comments
davidkel commented
for the query transactions java expects a certain number of parameters but the workload doesn't send enough. This results in an error in the contract api (which is probably a bug as it's not very meaningful)
Thread[fabric-txinvoke:1,5,main] 11:51:07:448 SEVERE org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask call [2eaadd5f] Invoke failed with error code 500. Sending ERROR
Thread[fabric-txinvoke:5,5,main] 11:51:07:448 SEVERE org.hyperledger.fabric.Logger error Index 3 out of bounds for length 3java.lang.IndexOutOfBoundsException: Index 3 out of bounds for length 3
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:458)
at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.convertArgs(ContractExecutionService.java:99)
at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:57)
at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:119)
at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:130)
at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:100)
at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Once this is addressed we get a further error trying to return a response. This is possibiby due to the object that is trying to be returned but again the java contravt-api results in an unexpected error and so probably a bug also in the java contract-api
Thread[fabric-txinvoke:5,5,main] 12:04:38:330 INFO org.hyperledger.fabric.contract.ContractRouter processRequest Got routing:paginatedRichQuery:org.example.FixedAssetContract
Thread[fabric-txinvoke:5,5,main] 12:04:38:345 SEVERE org.hyperledger.fabric.Logger error nulljava.lang.NullPointerException
at org.hyperledger.fabric.contract.execution.JSONTransactionSerializer.toBuffer(JSONTransactionSerializer.java:84)
at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.convertReturn(ContractExecutionService.java:89)
at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:67)
at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:119)
at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:130)
at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:100)
at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Shouldn't result in just a null pointer exception
fraVlaca commented
The error reported here has been fixed by #220 .
However another error arise ofwhich the cause is not very clear
2022-07-11 09:53:52.584 UTC 0774 WARN [endorser] ProcessProposal -> Failed to invoke chaincode channel=mychannel chaincode=fixed-asset error="error in simulation: transaction returned with failure: Unexpected error"
2022-07-11 09:53:52.584 UTC 0775 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.1:65272 grpc.peer_subject="CN=fabric-common" grpc.code=OK grpc.call_duration=1.08065215s
2022-07-11 09:53:52.600 UTC 0776 WARN [couchdb] queryDocuments -> The query [{"limit":10,"selector":{"creator":"client0","docType":"fixed-asset"}}] caused the following warning: [No matching index found, create an index to optimize query time.]
2022-07-11 09:53:52.602 UTC 0777 WARN [couchdb] queryDocuments -> The query [{"limit":10,"selector":{"creator":"client1","docType":"fixed-asset"}}] caused the following warning: [No matching index found, create an index to optimize query time.]
2022-07-11 09:53:52.603 UTC 0778 INFO [endorser] callChaincode -> finished chaincode: fixed-asset duration: 1069ms channel=mychannel txID=b7848e11
2022-07-11 09:53:52.603 UTC 0779 ERRO [endorser] simulateProposal -> failed to invoke chaincode fixed-asset, error: transaction returned with failure: Unexpected error
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
/go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:188
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:162
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/go/src/github.com/hyperledger/fabric/core/endorser/support.go:126
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:120
github.com/hyperledger/fabric/core/endorser.(*Endorser).simulateProposal
/go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:187
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposalSuccessfullyOrError
/go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:409
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:350
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/go/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/go/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:32
github.com/hyperledger/fabric-protos-go/peer._Endorser_ProcessProposal_Handler.func1
/go/src/github.com/hyperledger/fabric/vendor/github.com/hyperledger/fabric-protos-go/peer/peer.pb.go:107
github.com/hyperledger/fabric/internal/peer/node.unaryGrpcLimiter.func1
/go/src/github.com/hyperledger/fabric/internal/peer/node/grpc_limiters.go:56
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1
/go/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:25
github.com/hyperledger/fabric/common/grpclogging.UnaryServerInterceptor.func1
/go/src/github.com/hyperledger/fabric/common/grpclogging/server.go:92
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1
/go/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:25
github.com/hyperledger/fabric/common/grpcmetrics.UnaryServerInterceptor.func1
/go/src/github.com/hyperledger/fabric/common/grpcmetrics/interceptor.go:31
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1
/go/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:25
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1
/go/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric-protos-go/peer._Endorser_ProcessProposal_Handler
/go/src/github.com/hyperledger/fabric/vendor/github.com/hyperledger/fabric-protos-go/peer/peer.pb.go:109
google.golang.org/grpc.(*Server).processUnaryRPC
/go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1180
google.golang.org/grpc.(*Server).handleStream
/go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1503
google.golang.org/grpc.(*Server).serveStreams.func1.2
/go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:843
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1581 channel=mychannel txID=b7848e11