minifabric icon indicating copy to clipboard operation
minifabric copied to clipboard

minifab netup doesn't restart all(?)

Open pupi04 opened this issue 3 years ago • 7 comments
trafficstars

I have a network (with my own spec.yaml) with 4 Orgs with 2 peers each. When I start it for the first time (even installing my chaincode succesfully) I have no problems. I can even start my apiserver.js through a gateway with and Admin.id identity. But if I turn down (minifab down) the network and then turn it up (minifab netup, according to the docs), I have some errors with calling the chaincode with my apiserver. However, with a minifab cleanup and starting all again i resolve the problem, but i wonder if there's a way or something I miss in order to just turn the network down (without cleanup).

Here are the logs of all above:

minifab netup,create,join,anchorupdate -o org1.example.com -l node -s couchdb -e true

Using spec file: /home/pupi04/mywork/spec.yaml Minifab Execution Context: FABRIC_RELEASE=2.3.0 CHANNEL_NAME=mychannel PEER_DATABASE_TYPE=couchdb CHAINCODE_LANGUAGE=node CHAINCODE_NAME=simple CHAINCODE_VERSION=1.0 CHAINCODE_INIT_REQUIRED=true CHAINCODE_PARAMETERS="init","a","200","b","300" CHAINCODE_PRIVATE=false CHAINCODE_POLICY= TRANSIENT_DATA= BLOCK_NUMBER=newest EXPOSE_ENDPOINTS=true CURRENT_ORG=org1.example.com HOST_ADDRESSES=172.25.251.142 WORKING_DIRECTORY: /home/pupi04/mywork .......

Preparing for the following operations: *********************

verify options, download images, generate certificates, start network, network status, channel create, channel join, anchor update ...................

Running operation: ******************************************

verify options .

Running operation: ******************************************

download images ............

Running operation: ******************************************

generate certificates ...............................................................................................................................................................................................................................

Running operation: ******************************************

start network .........................

Running operation: ******************************************

network status ...

Current Minifabric image ID and created at date time ********

2b2a0b6e9999 2021-11-19 12:57:58 +0000 UTC .....

Docker node status ******************************************

mysite : Up 8 seconds ca1.org4.example.com : Up 11 seconds ca1.org3.example.com : Up 15 seconds ca1.org2.example.com : Up 18 seconds ca1.org1.example.com : Up 21 seconds orderer3.example.com : Up 25 seconds orderer2.example.com : Up 28 seconds orderer1.example.com : Up 32 seconds peer2.org4.example.com : Up 35 seconds peer1.org4.example.com : Up 38 seconds peer2.org3.example.com : Up 41 seconds peer1.org3.example.com : Up 45 seconds peer2.org2.example.com : Up 48 seconds peer1.org2.example.com : Up 51 seconds peer2.org1.example.com : Up 54 seconds peer1.org1.example.com : Up 56 seconds peer2.org4.example.com.couchdb : Up 59 seconds peer1.org4.example.com.couchdb : Up About a minute peer2.org3.example.com.couchdb : Up About a minute peer1.org3.example.com.couchdb : Up About a minute peer2.org2.example.com.couchdb : Up About a minute peer1.org2.example.com.couchdb : Up About a minute peer2.org1.example.com.couchdb : Up About a minute peer1.org1.example.com.couchdb : Up About a minute

Fabric network peer and orderer node health status **********

peer1.org1.example.com "OK" peer2.org1.example.com "OK" peer1.org2.example.com "OK" peer2.org2.example.com "OK" peer1.org3.example.com "OK" peer2.org3.example.com "OK" peer1.org4.example.com "OK" peer2.org4.example.com "OK" orderer1.example.com "OK" orderer2.example.com "OK" orderer3.example.com "OK" Network Status: 100%

Running operation: ******************************************

channel create ......

Running operation: ******************************************

channel join ...................................................

Running operation: ******************************************

anchor update ......................

STATS *******************************************************

minifab: ok=422 failed=0

real 4m9.360s user 2m48.033s sys 0m34.655s

Now I upload in the right dir my chaincode and then: minifab install,approve,commit,initialize,profilegen,discover -v 1.0 -n fabcar -l node -r true -p '"initLedger"'

Using spec file: /home/pupi04/mywork/spec.yaml Minifab Execution Context: FABRIC_RELEASE=2.3.0 CHANNEL_NAME=mychannel PEER_DATABASE_TYPE=couchdb CHAINCODE_LANGUAGE=node CHAINCODE_NAME=fabcar CHAINCODE_VERSION=1.0 CHAINCODE_INIT_REQUIRED=true CHAINCODE_PARAMETERS="initLedger" CHAINCODE_PRIVATE=true CHAINCODE_POLICY= TRANSIENT_DATA= BLOCK_NUMBER=newest EXPOSE_ENDPOINTS=true CURRENT_ORG=org1.example.com HOST_ADDRESSES=172.25.251.142 WORKING_DIRECTORY: /home/pupi04/mywork .......

Preparing for the following operations: *********************

verify options, cc install, cc approve, cc commit, cc initialize, profile generation, discover ...................

Running operation: ******************************************

verify options .

Running operation: ******************************************

cc install ................................................

Running operation: ******************************************

cc approve ......

Running operation: ******************************************

cc commit .............

Running operation: ******************************************

cc initialize ......

Running operation: ******************************************

profile generation .................................................

Running operation: ******************************************

discover ............................

Discover endorsers results **********************************

Chaincode endorsers file: ./vars/discover/mychannel/fabcar_endorsers.json

Discover orderers results ***********************************

Channel orderers file: ./vars/discover/mychannel/ordererendpoints.json

STATS *******************************************************

minifab: ok=208 failed=0

real 4m50.051s user 1m38.248s sys 0m16.751s

And everything works with my apiserver (on port 3000).

Now, if I just minifab down

and then minifab netup

Using spec file: /home/pupi04/mywork/spec.yaml Minifab Execution Context: FABRIC_RELEASE=2.3.0 CHANNEL_NAME=mychannel PEER_DATABASE_TYPE=couchdb CHAINCODE_LANGUAGE=node CHAINCODE_NAME=fabcar CHAINCODE_VERSION=1.0 CHAINCODE_INIT_REQUIRED=true CHAINCODE_PARAMETERS="initLedger" CHAINCODE_PRIVATE=true CHAINCODE_POLICY= TRANSIENT_DATA= BLOCK_NUMBER=newest EXPOSE_ENDPOINTS=true CURRENT_ORG=org1.example.com HOST_ADDRESSES=172.25.251.142 WORKING_DIRECTORY: /home/pupi04/mywork .......

Preparing for the following operations: *********************

verify options, download images, generate certificates, start network, network status .......

Running operation: ******************************************

verify options .

Running operation: ******************************************

download images ............

Running operation: ******************************************

generate certificates ..

Running operation: ******************************************

start network .....................

Running operation: ******************************************

network status ...

Current Minifabric image ID and created at date time ********

2b2a0b6e9999 2021-11-19 12:57:58 +0000 UTC .....

Docker node status ******************************************

dev-peer1.org4.example.com-fabcar_1.0-ce65be84e70e : Created dev-peer2.org4.example.com-fabcar_1.0-ce65be84e70e : Created dev-peer2.org3.example.com-fabcar_1.0-ce65be84e70e : Up 6 seconds dev-peer1.org3.example.com-fabcar_1.0-ce65be84e70e : Up 7 seconds mysite : Up 11 seconds dev-peer2.org2.example.com-fabcar_1.0-ce65be84e70e : Up 11 seconds ca1.org4.example.com : Up 16 seconds dev-peer1.org2.example.com-fabcar_1.0-ce65be84e70e : Up 17 seconds ca1.org3.example.com : Up 21 seconds dev-peer2.org1.example.com-fabcar_1.0-ce65be84e70e : Up 26 seconds ca1.org2.example.com : Up 28 seconds dev-peer1.org1.example.com-fabcar_1.0-ce65be84e70e : Up 28 seconds ca1.org1.example.com : Up 33 seconds orderer3.example.com : Up 41 seconds orderer2.example.com : Up 46 seconds orderer1.example.com : Up 52 seconds peer2.org4.example.com : Up 59 seconds peer1.org4.example.com : Up About a minute peer2.org3.example.com : Up About a minute peer1.org3.example.com : Up About a minute peer2.org2.example.com : Up About a minute peer1.org2.example.com : Up About a minute peer2.org1.example.com : Up About a minute peer1.org1.example.com : Up About a minute peer2.org4.example.com.couchdb : Up About a minute peer1.org4.example.com.couchdb : Up About a minute peer2.org3.example.com.couchdb : Up About a minute peer1.org3.example.com.couchdb : Up About a minute peer2.org2.example.com.couchdb : Up About a minute peer1.org2.example.com.couchdb : Up About a minute peer2.org1.example.com.couchdb : Up About a minute peer1.org1.example.com.couchdb : Up About a minute

Fabric network peer and orderer node health status **********

peer1.org1.example.com "OK" peer2.org1.example.com "OK" peer1.org2.example.com "OK" peer2.org2.example.com "OK" peer1.org3.example.com "OK" peer2.org3.example.com "OK" peer1.org4.example.com "OK" peer2.org4.example.com "OK" orderer1.example.com "OK" orderer2.example.com "OK" orderer3.example.com "OK" Network Status: 100%

STATS *******************************************************

minifab: ok=75 failed=0

real 2m16.549s user 0m59.415s sys 0m12.524s

Now, if i try to make a query/invoke through my apiserver, this is what I get:

2021-12-20T11:41:46.378Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer1.org1.example.com, url:grpcs://172.25.251.142:7004, connected:false, connectAttempted:true 2021-12-20T11:41:46.379Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org1.example.com url:grpcs://172.25.251.142:7004 timeout:3000 2021-12-20T11:41:46.379Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer1.org1.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer1.org1.example.com, url:grpcs://172.25.251.142:7004, connected:false, connectAttempted:true 2021-12-20T11:41:49.382Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer2.org1.example.com, url:grpcs://172.25.251.142:7005, connected:false, connectAttempted:true 2021-12-20T11:41:49.382Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer2.org1.example.com url:grpcs://172.25.251.142:7005 timeout:3000 2021-12-20T11:41:49.382Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer2.org1.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer2.org1.example.com, url:grpcs://172.25.251.142:7005, connected:false, connectAttempted:true 2021-12-20T11:41:52.385Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer1.org2.example.com, url:grpcs://172.25.251.142:7006, connected:false, connectAttempted:true 2021-12-20T11:41:52.385Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org2.example.com url:grpcs://172.25.251.142:7006 timeout:3000 2021-12-20T11:41:52.385Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer1.org2.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer1.org2.example.com, url:grpcs://172.25.251.142:7006, connected:false, connectAttempted:true 2021-12-20T11:41:55.388Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer2.org2.example.com, url:grpcs://172.25.251.142:7007, connected:false, connectAttempted:true 2021-12-20T11:41:55.388Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer2.org2.example.com url:grpcs://172.25.251.142:7007 timeout:3000 2021-12-20T11:41:55.388Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer2.org2.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer2.org2.example.com, url:grpcs://172.25.251.142:7007, connected:false, connectAttempted:true 2021-12-20T11:41:58.390Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer1.org3.example.com, url:grpcs://172.25.251.142:7008, connected:false, connectAttempted:true 2021-12-20T11:41:58.391Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org3.example.com url:grpcs://172.25.251.142:7008 timeout:3000 2021-12-20T11:41:58.391Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer1.org3.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer1.org3.example.com, url:grpcs://172.25.251.142:7008, connected:false, connectAttempted:true 2021-12-20T11:42:01.393Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer2.org3.example.com, url:grpcs://172.25.251.142:7009, connected:false, connectAttempted:true 2021-12-20T11:42:01.394Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer2.org3.example.com url:grpcs://172.25.251.142:7009 timeout:3000 2021-12-20T11:42:01.394Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer2.org3.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer2.org3.example.com, url:grpcs://172.25.251.142:7009, connected:false, connectAttempted:true 2021-12-20T11:42:04.398Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer1.org4.example.com, url:grpcs://172.25.251.142:7010, connected:false, connectAttempted:true 2021-12-20T11:42:04.398Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org4.example.com url:grpcs://172.25.251.142:7010 timeout:3000 2021-12-20T11:42:04.399Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer1.org4.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer1.org4.example.com, url:grpcs://172.25.251.142:7010, connected:false, connectAttempted:true 2021-12-20T11:42:07.400Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer2.org4.example.com, url:grpcs://172.25.251.142:7011, connected:false, connectAttempted:true 2021-12-20T11:42:07.400Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer2.org4.example.com url:grpcs://172.25.251.142:7011 timeout:3000 2021-12-20T11:42:07.400Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer2.org4.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer2.org4.example.com, url:grpcs://172.25.251.142:7011, connected:false, connectAttempted:true 2021-12-20T11:42:10.402Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer1.example.com, url:grpcs://172.25.251.142:7020, connected:false, connectAttempted:true 2021-12-20T11:42:10.402Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer1.example.com url:grpcs://172.25.251.142:7020 timeout:3000 2021-12-20T11:42:10.402Z - info: [NetworkConfig]: buildOrderer - Unable to connect to the committer orderer1.example.com due to Error: Failed to connect before the deadline on Committer- name: orderer1.example.com, url:grpcs://172.25.251.142:7020, connected:false, connectAttempted:true 2021-12-20T11:42:13.404Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer2.example.com, url:grpcs://172.25.251.142:7021, connected:false, connectAttempted:true 2021-12-20T11:42:13.404Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer2.example.com url:grpcs://172.25.251.142:7021 timeout:3000 2021-12-20T11:42:13.404Z - info: [NetworkConfig]: buildOrderer - Unable to connect to the committer orderer2.example.com due to Error: Failed to connect before the deadline on Committer- name: orderer2.example.com, url:grpcs://172.25.251.142:7021, connected:false, connectAttempted:true 2021-12-20T11:42:16.406Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer3.example.com, url:grpcs://172.25.251.142:7022, connected:false, connectAttempted:true 2021-12-20T11:42:16.406Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer3.example.com url:grpcs://172.25.251.142:7022 timeout:3000 2021-12-20T11:42:16.407Z - info: [NetworkConfig]: buildOrderer - Unable to connect to the committer orderer3.example.com due to Error: Failed to connect before the deadline on Committer- name: orderer3.example.com, url:grpcs://172.25.251.142:7022, connected:false, connectAttempted:true 2021-12-20T11:42:19.448Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Discoverer- name: peer1.org3.example.com, url:grpcs://172.25.251.142:7008, connected:false, connectAttempted:true 2021-12-20T11:42:19.449Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org3.example.com url:grpcs://172.25.251.142:7008 timeout:3000 2021-12-20T11:42:19.449Z - error: [ServiceEndpoint]: ServiceEndpoint grpcs://172.25.251.142:7008 reset connection failed :: Error: Failed to connect before the deadline on Discoverer- name: peer1.org3.example.com, url:grpcs://172.25.251.142:7008, connected:false, connectAttempted:true 2021-12-20T11:42:22.450Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Discoverer- name: peer2.org3.example.com, url:grpcs://172.25.251.142:7009, connected:false, connectAttempted:true 2021-12-20T11:42:22.450Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer2.org3.example.com url:grpcs://172.25.251.142:7009 timeout:3000 2021-12-20T11:42:22.451Z - error: [ServiceEndpoint]: ServiceEndpoint grpcs://172.25.251.142:7009 reset connection failed :: Error: Failed to connect before the deadline on Discoverer- name: peer2.org3.example.com, url:grpcs://172.25.251.142:7009, connected:false, connectAttempted:true 2021-12-20T11:42:22.451Z - error: [DiscoveryService]: send[mychannel] - no discovery results Failed to evaluate transaction: Error: DiscoveryService has failed to return results

What does my "netup" miss to restart successfully the network?

pupi04 avatar Dec 20 '21 11:12 pupi04

Try 'minifab discover' before you do a query. I am not really sure, down and netup should do it.

litong01 avatar Dec 20 '21 13:12 litong01

minifab discover

Using spec file: /home/pupi04/mywork/spec.yaml Minifab Execution Context: FABRIC_RELEASE=2.3.0 CHANNEL_NAME=mychannel PEER_DATABASE_TYPE=couchdb CHAINCODE_LANGUAGE=node CHAINCODE_NAME=fabcar CHAINCODE_VERSION=1.0 CHAINCODE_INIT_REQUIRED=true CHAINCODE_PARAMETERS="initLedger" CHAINCODE_PRIVATE=true CHAINCODE_POLICY= TRANSIENT_DATA= BLOCK_NUMBER=newest EXPOSE_ENDPOINTS=true CURRENT_ORG=org1.example.com HOST_ADDRESSES=172.25.243.11 WORKING_DIRECTORY: /home/pupi04/mywork .......

Preparing for the following operations: *********************

verify options, discover .......

Running operation: ******************************************

verify options .

Running operation: ******************************************

discover .........

Run the channel discover script on cli container ************

non-zero return code failed to create new connection: context deadline exceeded failed connecting to 172.25.251.142:7005: failed connecting to discovery service: failed to create new connection: context deadline exceeded

STATS *******************************************************

minifab: ok=28 failed=1

pupi04 avatar Dec 20 '21 13:12 pupi04

Hmmm, discover command even failed. I am not really sure. Can you see after down command if there are still some containers running ?

litong01 avatar Dec 20 '21 13:12 litong01

Down command should remove all the containers. If there are still containers running, it means some thing has gone wrong. Remove these running containers manually and try again.

litong01 avatar Dec 20 '21 14:12 litong01

Checking with "docker ps" (and in Docker Desktop too) I confirm that after minifab down, no containers are running.

Furthermore, don't know if it is relevant, but I got this situation expecially when I run "minifab down", then restart my machine, and "minifab netup". Could the machine restart be correlated to this problem?

pupi04 avatar Dec 20 '21 14:12 pupi04

Okay I confirm what I said:

CASE 1) minifab down + minifab netup: no problem, everything works successfully.

CASE 2) minifab down + restart the pc/machine + minifab netup: the problem above.

I just tried with my own network and my personal chaincode, don't know if the problem comes even with default network and chaincode.

pupi04 avatar Dec 20 '21 14:12 pupi04

Hmmm. Do not know if your restart actually somehow reset docker stats.

litong01 avatar Dec 20 '21 20:12 litong01