Hyperledger Fabric 2.0 byfn.sh error installing chaincode

北慕城南 提交于 2021-02-11 15:39:35

问题


I have the exact same issue as pointed out in this question: Error: failed to endorse chaincode install: rpc error: code = Unavailable desc = transport is closing

If you are choosing to answer this question, please do review the question in the link as my issue is exactly the same except that my environment is as follows:

    OS: RHEL 7.7
    Go version: 1.13.7
    Node version: 12.13.0
    Docker version: 18.09.7 (Client and Engine)
    NO INTERNET ACCESS

I execute the script with the following command:

./byfn.sh up -a -s couchdb -l javascript -v

The only other thing I can add to the other (unanswered) question is the output of the docker logs for peer0.org1.example.com:

2020-04-15 20:52:21.548 UTC [gossip.channel] reportMembershipChanges -> INFO 05d [[mychannel] Membership view has changed. peers went online:  [[peer0.org2.example.com:9051 ] [peer1.org2.example.com:10051 ]] , current view:  [[peer1.org1.example.com:8051] [peer0.org2.example.com:9051 ] [peer1.org2.example.com:10051 ]]]
2020-04-15 20:57:20.764 UTC [endorser] callChaincode -> INFO 05e finished chaincode: _lifecycle duration: 300000ms channel= txID=dfbc8dc6
2020-04-15 20:57:20.764 UTC [endorser] SimulateProposal -> ERRO 05f failed to invoke chaincode _lifecycle, error: timeout expired while executing transaction
github.com/hyperledger/fabric/core/chaincode.(*Handler).Execute
    /go/src/github.com/hyperledger/fabric/core/chaincode/handler.go:1215
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).execute
    /go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:272
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Invoke
    /go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
    /go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:155
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:114
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
    /go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:173
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposalSuccessfullyOrError
    /go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:377
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
    /go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:320
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/vendor/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/common/grpclogging.UnaryServerInterceptor.func1
    /go/src/github.com/hyperledger/fabric/common/grpclogging/server.go:92
github.com/hyperledger/fabric/vendor/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/hyperledger/fabric/vendor/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/vendor/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/vendor/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
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
    /go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:995
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
    /go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1275
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
    /go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:710
runtime.goexit
    /usr/local/go/src/runtime/asm_amd64.s:1357
error sending
failed to execute transaction dfbc8dc6777361d37da9a542fbe95ef35c6188d4f2719b80c4827b724f92b87f
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
    /go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:161
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
    /go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:156
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:114
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
    /go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:173
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposalSuccessfullyOrError
    /go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:377
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
    /go/src/github.com/hyperledger/fabric/core/endorser/endorser.go:320
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/vendor/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/common/grpclogging.UnaryServerInterceptor.func1
    /go/src/github.com/hyperledger/fabric/common/grpclogging/server.go:92
github.com/hyperledger/fabric/vendor/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/hyperledger/fabric/vendor/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/vendor/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/vendor/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
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
    /go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:995
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
    /go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1275
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
    /go/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:710
runtime.goexit
    /usr/local/go/src/runtime/asm_amd64.s:1357 channel= txID=dfbc8dc6
2020-04-15 20:57:20.764 UTC [comm.grpc.server] 1 -> INFO 060 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.23.0.17:60354 grpc.code=OK grpc.call_duration=5m0.001572359s
2020-04-15 20:58:51.215 UTC [lifecycle] InstallChaincode -> INFO 061 Successfully installed chaincode with package ID 'mycc_1:1a85dbaa408ea570f05740792f9cd3c140d2b3c40b2bea1002d33aa13fb3d6e6'

EDIT (4/17/2020) SOME NEW INFO:

  1. The peer lifecycle chaincode install command consistently fails after 5 minutes (timeout per the docker logs above).
  2. Subsequently (see the last two lines of the docker logs), the chaincode does get installed.
  3. I modified the first-network/scripts/utils.sh function installChaincode to the code below and then everything works to completion successfully.
    installChaincode() {
      PEER=$1
      ORG=$2
      setGlobals $PEER $ORG
      set -x
      peer lifecycle chaincode install mycc.tar.gz >&log.txt
      res=$?
      set +x
      cat log.txt
      if [ ${CC_RUNTIME_LANGUAGE} = "node" ];
      then
            echo "chaincode install returned $res"
            echo "sleeping for 10 minutes..."
            sleep 600
      else
            verifyResult $res "installation on peer${PEER}.org${ORG} has failed"
      fi
      echo "== Chaincode is installed on peer${PEER}.org${ORG} =============== "
      echo
    }

I wonder why the peer lifecycle chaincode install returns an error after about a minute or so even though there is a SimulateProposal command working in the background (see docker logs above - first few lines).

And then, why does the chaincode install actually work if the installation command returns an error? I say this because a subsequent call to queryInstalled returns successful from the byfn.sh script.


回答1:


Since you are using Hyperledger Fabric, I wouldn't recommend building the byfn. It has been deprecated from HLF. Instead, try with test-network as it's suggested from HLF.

For the 2.0 version, they have added the note on top of the page.



来源:https://stackoverflow.com/questions/61239286/hyperledger-fabric-2-0-byfn-sh-error-installing-chaincode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!