美文网首页
Fabric踩坑问题记录(无法创建交易链)

Fabric踩坑问题记录(无法创建交易链)

作者: TeaR0502 | 来源:发表于2020-01-12 02:04 被阅读0次

    我在生成的时候都挺顺利的。
    docker compose 启动也都正常

    peer channel list 响应结果也是预期的(可以连上节点,看到连接的通道是空的)

    但是我在创建通道的时候发生了异常

    具体指令为
    peer channel create -o orderer.t4cloud.com:7050 -c t4channel -f /etc/hyperledger/config/t4cloud.tx

    其中的orderer.t4cloud.com,容器启动正常,我之前看过docker启动log,确实是等待服务的日志(视频中说这样就是启动成功了)
    通道名称t4channel这个也是正常的,我尝试过使用别的,就会提示通道ID不一致。
    最后的交易文件读取正常,如果修改成别的,也会提示文件无法读取

    令我困惑的是他的异常提示,是空的,导致百度无法下手,看过好一些,无法解决,只能向老师求助一下。

    图片描述

    这是我的docker容器运行状态,看起来版本号都是1.0.0应该也没错

    图片描述

    此时被提醒查看order节点日志

    --以下是补充的order日志

    图片描述

    我搜索过这个显眼的红色部分的异常,有一个前辈说是order节点的配置不对,正确的应该是GENESISMETHOD=file,我看了docker-compose中的order配置,我的确实是对的。其他能搜索到的结果都和这个不一样,陷入茫然。

    然后我注意到了蓝色部分,也去搜索了一下,同样只有疑问没有解决办法。

    再次求助前辈,发现我犯了一个简单的错误

    以下是我使用的命令

    生成证书
    ./cryptogen generate --config=./crypto-config.yaml
    
    创建创世区块及交易
    ./configtxgen -profile OneOrgOrdererGenesis -outputBlock ./config/genesis.block -channelID t4channel
    ./configtxgen -profile TwoOrgChannel -outputCreateChannelTx ./config/t4cloud.tx -channelID t4channel
    
    创建通道
    peer channel create -o orderer.t4cloud.com:7050 -c t4channel -f /etc/hyperledger/config/t4cloud.tx
    

    注意,一个是生成系统链,一个是生成交易链,ID不可一样!

    后续异常补充

    在我使用小写的不同的名字的时候,出现了go语言的异常,看起来好像是没有响应信息。
    (这个我搜了下说是GO语言的环境有问题,可是当前是在官方的docker镜像中……)

    图片描述

    详细信息如下

    2020-01-11 17:24:33.455 UTC [msp] GetDefaultSigningIdentity -> DEBU 018 Obtaining default signing identity
    fatal error: unexpected signal during runtime execution
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f2b85f38259]
    
    runtime stack:
    runtime.throw(0xddc732, 0x2a)
        /opt/go/src/runtime/panic.go:566 +0x95
    runtime.sigpanic()
        /opt/go/src/runtime/sigpanic_unix.go:12 +0x2cc
    
    goroutine 7 [syscall, locked to thread]:
    runtime.cgocall(0xb1e190, 0xc4200235f8, 0xc400000000)
        /opt/go/src/runtime/cgocall.go:131 +0x110 fp=0xc4200235b0 sp=0xc420023570
    net._C2func_getaddrinfo(0x7f2b780008c0, 0x0, 0xc420181410, 0xc42002a258, 0x0, 0x0, 0x0)
        ??:0 +0x68 fp=0xc4200235f8 sp=0xc4200235b0
    net.cgoLookupIPCNAME(0x7fff5487d7e4, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /opt/go/src/net/cgo_unix.go:146 +0x37c fp=0xc420023718 sp=0xc4200235f8
    net.cgoIPLookup(0xc420016720, 0x7fff5487d7e4, 0x13)
        /opt/go/src/net/cgo_unix.go:198 +0x4d fp=0xc4200237a8 sp=0xc420023718
    runtime.goexit()
        /opt/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc4200237b0 sp=0xc4200237a8
    created by net.cgoLookupIP
        /opt/go/src/net/cgo_unix.go:208 +0xb4
    
    goroutine 1 [runnable]:
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).GetMethodConfig(0xc42039e820, 0xdd0d4c, 0x20, 0x0, 0x0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:676 +0x170
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newClientStream(0x7f2b86affd40, 0xc4200641b8, 0x14043e0, 0xc42039e820, 0xdd0d4c, 0x20, 0x0, 0x0, 0x0, 0x0, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/stream.go:116 +0x109
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.NewClientStream(0x7f2b86affd40, 0xc4200641b8, 0x14043e0, 0xc42039e820, 0xdd0d4c, 0x20, 0x0, 0x0, 0x0, 0x18, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/stream.go:105 +0x162
    github.com/hyperledger/fabric/protos/orderer.(*atomicBroadcastClient).Deliver(0xc4200725e8, 0x7f2b86affd40, 0xc4200641b8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0xc0)
        /opt/gopath/src/github.com/hyperledger/fabric/protos/orderer/ab.pb.go:499 +0xba
    github.com/hyperledger/fabric/peer/channel.InitCmdFactory(0xc420360100, 0x0, 0x0, 0x14106a0)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:179 +0x2c0
    github.com/hyperledger/fabric/peer/channel.getGenesisBlock(0xc42035abe0, 0x0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/deliverclient.go:141 +0x11c
    github.com/hyperledger/fabric/peer/channel.executeCreate(0xc42035abe0, 0xc42035abe0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:183 +0x50
    github.com/hyperledger/fabric/peer/channel.create(0xc42027a240, 0xc42036c300, 0x0, 0x6, 0xc42035abe0, 0xdb63de, 0x5)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:213 +0x45
    github.com/hyperledger/fabric/peer/channel.createCmd.func1(0xc42027a240, 0xc42036c300, 0x0, 0x6, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:59 +0x52
    github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0xc42027a240, 0xc42036c240, 0x6, 0x6, 0xc42027a240, 0xc42036c240)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 +0x234
    github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1407d60, 0xf, 0xc420010035, 0x7)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 +0x367
    github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x1407d60, 0x36, 0xc420010035)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 +0x2b
    main.main()
        /opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 +0x54e
    
    goroutine 17 [syscall, locked to thread]:
    runtime.goexit()
        /opt/go/src/runtime/asm_amd64.s:2086 +0x1
    
    goroutine 22 [syscall]:
    os/signal.signal_recv(0xc420022fa8)
        /opt/go/src/runtime/sigqueue.go:116 +0x157
    os/signal.loop()
        /opt/go/src/os/signal/signal_unix.go:22 +0x22
    created by os/signal.init.1
        /opt/go/src/os/signal/signal_unix.go:28 +0x41
    
    goroutine 6 [select]:
    net.cgoLookupIP(0x141ef60, 0xc420016660, 0x7fff5487d7e4, 0x13, 0xc42022e480, 0xc420024668, 0x0, 0x0, 0x0, 0x0)
        /opt/go/src/net/cgo_unix.go:209 +0x2f5
    net.lookupIP(0x141ef60, 0xc420016660, 0x7fff5487d7e4, 0x13, 0xc42036c960, 0x0, 0x0, 0x0, 0x40005)
        /opt/go/src/net/lookup_unix.go:70 +0xf9
    net.glob..func11(0x141ef60, 0xc420016660, 0xe45118, 0x7fff5487d7e4, 0x13, 0xc4200246c8, 0x720699, 0xc420024708, 0xc420024718, 0x455cc0)
        /opt/go/src/net/hook.go:19 +0x52
    net.lookupIPContext.func1(0xc42039e820, 0x7fff5487d7e4, 0x18, 0x0)
        /opt/go/src/net/lookup.go:119 +0x5c
    internal/singleflight.(*Group).doCall(0x143be60, 0xc42001ba90, 0x7fff5487d7e4, 0x13, 0xc4201813b0)
        /opt/go/src/internal/singleflight/singleflight.go:93 +0x3c
    created by internal/singleflight.(*Group).DoChan
        /opt/go/src/internal/singleflight/singleflight.go:86 +0x339
    
    goroutine 41 [select]:
    net.lookupIPContext(0x141ef60, 0xc420016660, 0x7fff5487d7e4, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0)
        /opt/go/src/net/lookup.go:122 +0x7bc
    net.internetAddrList(0x141ef60, 0xc420016660, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0x0, 0x0, ...)
        /opt/go/src/net/ipsock.go:241 +0x5e0
    net.resolveAddrList(0x141ef60, 0xc420016660, 0xdb5da8, 0x4, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, ...)
        /opt/go/src/net/dial.go:179 +0x106
    net.(*Dialer).DialContext(0xc42004b6c8, 0x141ef60, 0xc420016660, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0x0, ...)
        /opt/go/src/net/dial.go:329 +0x238
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.dialContext(0x141ef60, 0xc420016660, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0xc4201462d0, 0xc420156b80)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/go17.go:53 +0xaa
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.DialContext.func1(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x1, 0x0, 0x14106a0, 0xc42018c910)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:341 +0x86
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newProxyDialer.func1(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x13, 0x410a5e, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/proxy.go:136 +0x143
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.dial(0x7f2b86affe00, 0xc420016660, 0xc420371aa0, 0x7fff5487d7e4, 0x18, 0x410a5e, 0xc42013e1e0, 0xa0, 0x98)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:135 +0x5a
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.newHTTP2Client(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0xdc17ea, 0x11, 0x0, 0x0, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:173 +0xbf
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.NewClientTransport(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0xdc17ea, 0x11, 0x0, 0x0, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/transport.go:463 +0xae
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*addrConn).resetTransport(0xc4200f7a40, 0xc42036da00, 0x70e60c, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:876 +0x282
    github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).resetAddrConn.func1(0xc4200f7a40)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:648 +0x34
    created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).resetAddrConn
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:657 +0x756
    
    

    然后看order节点的日志,好像是没问题,都成功了,排除order的问题

    图片描述

    在这种情况下,我尝试过无视异常,然后加入链,会提示tx文件不存在。
    如果再次生成链,会生成失败,提示version为1,我搜了下,好像是代表链已存在。

    【最终问题解决,成功创建通道】
    网上说可能是容器环境有问题,一样面向百度,发现有个前辈说在官方提供的client容器的GODNS是不对的。看起来是个GO语言的问题,也不管什么容器,在所有的镜像都加上修正参数。

    注意点
    1.创世区块和交易链的通道ID不能一样
    2.通道名称,不能有大写,(因为我写JAVA习惯了驼峰),但是在此处会有一场,order节点日志:通道ID有非法自读
    3.cli客户端的环境变量中缺少 - GODEBUG=netdns=go 导致响应异常。

    相关文章

      网友评论

          本文标题:Fabric踩坑问题记录(无法创建交易链)

          本文链接:https://www.haomeiwen.com/subject/lhhiactx.html