安装链码的Hyperledger Fabric 2.0 byfn.sh错误

时间:2020-04-15 21:53:56

标签: hyperledger-fabric hyperledger-chaincode

我遇到的问题与此完全相同:Error: failed to endorse chaincode install: rpc error: code = Unavailable desc = transport is closing

如果您选择回答此问题,请检查链接中的问题,因为我的问题与我的问题完全相同,但我的环境如下:

    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

我使用以下命令执行脚本:

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

我可以添加到另一个(未回答)问题的唯一另一件事是peer0.org1.example.com的docker日志的输出:

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'

编辑(4/17/2020) 一些新信息:

  1. 对等生命周期chaincode安装命令在5分钟后始终失败(根据上述docker日志的超时)。
  2. 随后(请参阅docker日志的最后两行),确实安装了链码。
  3. 我修改了first-network / scripts / utils.sh函数 installChaincode到下面的代码,然后一切正常 完成成功。
    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
    }

我想知道为什么即使在后台运行SimulateProposal命令后,对等生命周期链代码安装也会在大约一分钟后返回错误(请参阅上面的docker日志-前几行)。

然后,如果安装命令返回错误,为什么链码安装实际上可以工作?我之所以这样说,是因为随后对queryInstalled的调用从byfn.sh脚本中成功返回。

1 个答案:

答案 0 :(得分:0)

由于您使用的是Hyperledger Fabric,因此我不建议您构建byfn。 HLF不推荐使用。相反,请根据HLF的建议尝试使用test-network

对于2.0版本,他们在页面顶部添加了note