Welcome to the Linux Foundation Forum!

Lab 4: Instantiat chaincode problem: peer container crash with Getting block information from block

Hello

I'm struggling with some errors after start to use couchdb, now everything seems to work well, I install the chaincode but when I try to instantiate it start to give me errors like

$ peer chaincode install -n ccForAll -p github.com/sacc -v 1.0
2019-11-02 01:07:14.215 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-11-02 01:07:14.240 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-11-02 01:07:14.260 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-11-02 01:07:14.261 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2019-11-02 01:07:15.407 UTC [chaincodeCmd] install -> INFO 005 Installed remotely response:<status:200 payload:"OK" > 

$ peer chaincode instantiate -n ccForAll -v 1.0 -o orderer.example.com:7050 -C allarewelcome -c '{"Args":["Mach","50"]}'
Error: error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [allarewelcome] creator org [Org1MSP]

when I try to see if peers are in channel, it seems that they are not, maybe because of a container restart, but now the problem is bigger when I try to join channel I have this crach container problem :(

$ docker exec -it peer0.org1.example.com bash
# check first that we are not parte of the channel
$ peer channel list
# fetch genesis block
$ peer channel fetch oldest allarewelcome.block -c allarewelcome --orderer orderer.example.com:7050
# ls allarewelcome.block 
allarewelcome.block
# setup CORE_PEER_MSPCONFIGPATH 
$ export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin\@org1.example.com/msp
# add peer to channel
$ peer channel join -b allarewelcome.block

logs

peer1.org1.example.com    | 2019-11-02 02:00:40.969 UTC [endorser] callChaincode -> INFO 028 [][137f1239] Entry chaincode: name:"cscc" 
peer1.org1.example.com    | 2019-11-02 02:00:40.971 UTC [ledgermgmt] CreateLedger -> INFO 029 Creating ledger [allarewelcome] with genesis block
peer1.org1.example.com    | 2019-11-02 02:00:41.033 UTC [fsblkstorage] newBlockfileMgr -> INFO 02a Getting block information from block storage
peer1.org1.example.com    | panic: runtime error: invalid memory address or nil pointer dereference
peer1.org1.example.com    |     panic: runtime error: invalid memory address or nil pointer dereference
peer1.org1.example.com    | [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xcecbb6]
peer1.org1.example.com    | 
peer1.org1.example.com    | goroutine 310 [running]:
peer1.org1.example.com    | github.com/hyperledger/fabric/core/chaincode/shim.(*Handler).triggerNextState(0xc00053d320, 0x0, 0xc00053a4e0)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/handler.go:35 +0x26
peer1.org1.example.com    | github.com/hyperledger/fabric/core/chaincode/shim.(*Handler).handleTransaction.func1.1(0xc00053d320, 0xc0004ebeb0, 0xc00053a4e0)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/handler.go:247 +0x42
peer1.org1.example.com    | panic(0x106e340, 0x1e32280)
peer1.org1.example.com    |     /opt/go/src/runtime/panic.go:513 +0x1b9
peer1.org1.example.com    | github.com/hyperledger/fabric/core/ledger/kvledger.(*Provider).openInternal(0xc0000beb80, 0xc000046dd0, 0xd, 0x0, 0x0, 0x0, 0x27)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/kv_ledger_provider.go:157 +0xf5
peer1.org1.example.com    | github.com/hyperledger/fabric/core/ledger/kvledger.(*Provider).Create(0xc0000beb80, 0xc0002a8cc0, 0x27, 0xc0004eb7a8, 0x1, 0x1)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/kv_ledger_provider.go:117 +0x102
peer1.org1.example.com    | github.com/hyperledger/fabric/core/ledger/ledgermgmt.CreateLedger(0xc0002a8cc0, 0x0, 0x0, 0x0, 0x0)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:97 +0x17b
peer1.org1.example.com    | github.com/hyperledger/fabric/core/peer.CreateChainFromBlock(0xc0002a8cc0, 0x1378f60, 0xc00000edc0, 0x1383c80, 0xc0004dc6e0, 0x1, 0x1)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/peer/peer.go:436 +0x7b
peer1.org1.example.com    | github.com/hyperledger/fabric/core/scc/cscc.joinChain(0xc0000466e0, 0xd, 0xc0002a8cc0, 0x1378f60, 0xc00000edc0, 0x1383c80, 0xc0004dc6e0, 0x0, 0x0, 0x0, ...)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/scc/cscc/configure.go:236 +0x79
peer1.org1.example.com    | github.com/hyperledger/fabric/core/scc/cscc.(*PeerConfiger).InvokeNoShim(0xc0004dcc30, 0xc0002cf7a0, 0x2, 0x2, 0xc0003f1db0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/scc/cscc/configure.go:164 +0x692
peer1.org1.example.com    | github.com/hyperledger/fabric/core/scc/cscc.(*PeerConfiger).Invoke(0xc0004dcc30, 0x1390b60, 0xc0005986e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/scc/cscc/configure.go:120 +0x29b
peer1.org1.example.com    | github.com/hyperledger/fabric/core/chaincode/shim.(*Handler).handleTransaction.func1(0xc00053d320, 0xc00053a4e0, 0xc0000bf300)
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/handler.go:273 +0x4eb
peer1.org1.example.com    | created by github.com/hyperledger/fabric/core/chaincode/shim.(*Handler).handleTransaction
peer1.org1.example.com    |     /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/handler.go:242 +0x53
peer1.org1.example.com exited with code 2

any help will be great, thanks guys :)

K

Comments

  • koakh
    koakh Posts: 11

    update:

    I forget to mention that now I can't even launch this basic command,
    it seems that my network breaks again just to try to follow the pdf instructions,
    and I can't always restart from start :(

    $ docker exec -it peer1.org1.example.com bash
    
    root@4a58a9c918a7:/opt/gopath/src/github.com/hyperledger/fabric# peer channel fetch oldest allarewelcome.block -c allarewelcome --orderer orderer.example.com:7050
    2019-11-02 02:15:11.839 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
    2019-11-02 02:15:11.842 UTC [cli.common] readBlock -> INFO 002 Received block: 0
    
    root@4a58a9c918a7:/opt/gopath/src/github.com/hyperledger/fabric# ls
    allarewelcome.block
    
    root@4a58a9c918a7:/opt/gopath/src/github.com/hyperledger/fabric# peer channel list
    2019-11-02 02:10:39.343 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
    Error: Failed sending proposal, got rpc error: code = Unavailable desc = transport is closing
    

    thanks

  • koakh
    koakh Posts: 11

    Hello

    aftre some debug, I have luck
    it seems that channel data allarewelcome_ is lost in couchdb,
    I drop all couchdb volumes and start service stack
    and recreate it and it with above commands, and now peer channel list starts to work again :)

    # Create the channel
    docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c allarewelcome -f /etc/hyperledger/configtx/allarewelcome.tx
    # Join peer0.org1.example.com to the channel.
    docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel join -b allarewelcome.block
    

    now it seems that it instantiate the chaincode :)

    $ peer chaincode instantiate -n ccForAll -v 1.0 -o orderer.example.com:7050 -C allarewelcome -c '{"Args":["Mach","50"]}'
    2019-11-02 02:35:19.769 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
    2019-11-02 02:35:19.781 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
    2019-11-02 02:35:19.785 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
    2019-11-02 02:35:19.785 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
    
    $ peer chaincode list --installed
    Get installed chaincodes on peer:
    Name: ccForAll, Version: 1.0, Path: github.com/sacc, Id: ebccdb27247faa8febc6cdb17a288dafcdb21d6484cfafcbcf8a46eacbf9dbfd
    
    $ peer chaincode list --instantiated -C allarewelcome
    Get instantiated chaincodes on channel allarewelcome:
    Name: ccForAll, Version: 1.0, Path: github.com/sacc, Escc: escc, Vscc: vscc
    
  • @koakh said:
    Hello

    aftre some debug, I have luck
    it seems that channel data allarewelcome_ is lost in couchdb,
    I drop all couchdb volumes and start service stack
    and recreate it and it with above commands, and now peer channel list starts to work again :)

    # Create the channel
    docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c allarewelcome -f /etc/hyperledger/configtx/allarewelcome.tx
    # Join peer0.org1.example.com to the channel.
    docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel join -b allarewelcome.block
    

    now it seems that it instantiate the chaincode :)

    $ peer chaincode instantiate -n ccForAll -v 1.0 -o orderer.example.com:7050 -C allarewelcome -c '{"Args":["Mach","50"]}'
    2019-11-02 02:35:19.769 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
    2019-11-02 02:35:19.781 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
    2019-11-02 02:35:19.785 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
    2019-11-02 02:35:19.785 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
    
    $ peer chaincode list --installed
    Get installed chaincodes on peer:
    Name: ccForAll, Version: 1.0, Path: github.com/sacc, Id: ebccdb27247faa8febc6cdb17a288dafcdb21d6484cfafcbcf8a46eacbf9dbfd
    
    $ peer chaincode list --instantiated -C allarewelcome
    Get instantiated chaincodes on channel allarewelcome:
    Name: ccForAll, Version: 1.0, Path: github.com/sacc, Escc: escc, Vscc: vscc
    

    Hi @koakh ,
    Could you please explain in more detail what you did here as I have the exact same error:

    it seems that channel data allarewelcome_ is lost in couchdb,
    I drop all couchdb volumes and start service stack
    and recreate it and it with above commands, and now peer channel list starts to work again :)

  • Seems to be an error with the couchDb containers?

    [info] 2019-11-26T10:28:38.398968Z nonode@nohost <0.195.0> -------- Apache CouchDB has started on http://any:5986/
    [info] 2019-11-26T10:28:38.399538Z nonode@nohost <0.7.0> -------- Application couch started on node nonode@nohost
    [info] 2019-11-26T10:28:38.399838Z nonode@nohost <0.7.0> -------- Application ets_lru started on node nonode@nohost
    [info] 2019-11-26T10:28:38.428548Z nonode@nohost <0.7.0> -------- Application rexi started on node nonode@nohost
    [info] 2019-11-26T10:28:38.441617Z nonode@nohost <0.201.0> -------- open_result error {not_found,no_db_file} for _nodes
    [warning] 2019-11-26T10:28:38.441655Z nonode@nohost <0.271.0> -------- creating missing database: _nodes
    [info] 2019-11-26T10:28:38.470566Z nonode@nohost <0.201.0> -------- open_result error {not_found,no_db_file} for _dbs
    [warning] 2019-11-26T10:28:38.470600Z nonode@nohost <0.285.0> -------- creating missing database: _dbs
    [warning] 2019-11-26T10:28:38.470639Z nonode@nohost <0.284.0> -------- creating missing database: _dbs
    [info] 2019-11-26T10:28:38.478597Z nonode@nohost <0.7.0> -------- Application mem3 started on node nonode@nohost
    [info] 2019-11-26T10:28:38.478957Z nonode@nohost <0.7.0> -------- Application fabric started on node nonode@nohost
    [info] 2019-11-26T10:28:38.529437Z nonode@nohost <0.7.0> -------- Application chttpd started on node nonode@nohost
    [notice] 2019-11-26T10:28:38.553132Z nonode@nohost <0.322.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:395) <= mem3_shards:load_shards_from_disk/1(line:370) <= mem3_shards:load_shards_from_disk/2(line:399) <= mem3_shards:for_docid/3(line:86) <= fabric_doc_open:go/3(line:38) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:187) <= chttpd_auth_cache:listen_for_changes/1(line:134)
    [error] 2019-11-26T10:28:38.555361Z nonode@nohost emulator -------- Error in process <0.323.0> with exit value:
    {database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,395}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,370}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,399}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,86}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,38}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,187}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,134}]}]}

Categories

Upcoming Training