Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error waiting for container: context canceled #284

Closed
shaofq opened this issue Feb 3, 2022 · 9 comments
Closed

error waiting for container: context canceled #284

shaofq opened this issue Feb 3, 2022 · 9 comments

Comments

@shaofq
Copy link

shaofq commented Feb 3, 2022

occur frequently :error waiting for container: context canceled
my conifg:
{
"$schema": "https://github.com/softwaremill/fablo/releases/download/1.0.0/schema.json",
"global": {
"fabricVersion": "2.3.2",
"tls": false,
"tools": {
"explorer": true
}
},
"orgs": [
{
"organization": {
"name": "Orderer",
"domain": "orderer.qhd.com"
},
"orderers": [
{
"groupName": "group1",
"type": "solo",
"instances": 1
}
]
},
{
"organization": {
"name": "Org1",
"domain": "org1.qhd.com"
},
"peer": {
"instances": 1,
"db": "LevelDb"
},
"orderers": [
{
"groupName": "group1",
"type": "solo",
"instances": 1
}
]
},
{
"organization": {
"name": "Org2",
"domain": "org2.qhd.com"
},
"peer": {
"instances": 1,
"db": "LevelDb"
},
"orderers": [
{
"groupName": "group1",
"type": "solo",
"instances": 1
}
]
},
{
"organization": {
"name": "Org3",
"domain": "org3.qhd.com"
},
"peer": {
"instances":1,
"db": "LevelDb"
},
"orderers": [
{
"groupName": "group1",
"type": "solo",
"instances": 1
}
]
},
{
"organization": {
"name": "Org4",
"domain": "org4.qhd.com"
},
"peer": {
"instances":1,
"db": "LevelDb"
},
"orderers": [
{
"groupName": "group1",
"type": "solo",
"instances": 1
}
]
},
{
"organization": {
"name": "Org5",
"domain": "org5.qhd.com"
},
"peer": {
"instances":1,
"db": "LevelDb"
},
"orderers": [
{
"groupName": "group1",
"type": "solo",
"instances": 1
}
]
}
],
"channels": [
{
"name": "my-channelqhd",
"orgs": [
{
"name": "Org1",
"peers": [
"peer0"
]
},{
"name": "Org2",
"peers": [
"peer0"
]
},{
"name": "Org3",
"peers": [
"peer0"
]
},{
"name": "Org4",
"peers": [
"peer0"
]
},{
"name": "Org5",
"peers": [
"peer0"
]
}
]
}
],
"chaincodes": [
{
"name": "chaincodeqhd",
"version": "0.0.1",
"lang": "java",
"channel": "my-channelqhd",
"directory": "./chaincodes/chaincode-java-simple"
}
]
}

@dzikowski
Copy link
Contributor

Your network seems to be quite big (~26 running docker containers in total). Please check if you have enough RAM available for Docker (I would say 10-12GB). If the issue remains, please send us full Fablo output

@jerry-98
Copy link

jerry-98 commented Feb 8, 2022

I am running 4 orgs with 1 peer each and couchdb for each peer and I am using 3 orderers with raft and but when tls : 'true',
When I execute docker exec cli.org1.com peer chaincode invoke peer0.org1.com -C "my-channel1" -n "chaincode1" -c '{"Args":["KVContract:get", "name"]}'

Error ::
2022-02-08 12:01:29.644 UTC 0001 INFO [chaincodeCmd] InitCmdFactory -> Retrieved channel (my-channel1) orderer endpoint: orderer0.group1.orderer.com:7030
Error: error getting broadcast client: orderer client failed to connect to orderer0.group1.orderer.com:7030: failed to create new connection: context deadline exceeded

Please Help

@jerry-98
Copy link

jerry-98 commented Feb 8, 2022

{
"$schema": "https://github.com/softwaremill/fablo/releases/download/1.0.0/schema.json",
"global": {
"fabricVersion": "2.4.0",
"tls": true
},
"orgs": [
{
"organization": {
"name": "Orderer",
"domain": "orderer.com"
},
"orderers": [
{
"groupName": "group1",
"type": "raft",
"instances": 3
}
],
"tools": {
"fabloRest": true
}
},
{
"organization": {
"name": "Org1",
"domain": "org1.com"
},
"peer": {
"instances": 1,
"db": "CouchDb"
},
"tools": {
"fabloRest": true
}
},
{
"organization": {
"name": "Org2",
"domain": "org2.com"
},
"peer": {
"instances": 1,
"db": "CouchDb"
},
"tools": {
"fabloRest": true
}
},
{
"organization": {
"name": "Org3",
"domain": "org3.com"
},
"peer": {
"instances": 1,
"db": "CouchDb"
},
"tools": {
"fabloRest": true
}
},
{
"organization": {
"name": "Org4",
"domain": "org4.com"
},
"peer": {
"instances": 1,
"db": "CouchDb"
},
"tools": {
"fabloRest": true
}
}

],
"channels": [
{
"name": "my-channel1",
"orgs": [
{
"name": "Org1",
"peers": [
"peer0"
]
},
{
"name": "Org2",
"peers": [
"peer0"
]
},
{
"name": "Org3",
"peers": [
"peer0"
]
},
{
"name": "Org4",
"peers": [
"peer0"
]
}
]
}
],
"chaincodes": [
{
"name": "chaincode1",
"version": "0.0.1",
"lang": "node",
"channel": "my-channel1",
"directory": "./chaincodes/chaincode-kv-node"
}
]
}

@Hejwo
Copy link
Contributor

Hejwo commented Feb 8, 2022

Hi @jerry-98
it's probably because of tls enabled. Additional parameters need to be passed if it's on:

docker exec cli.org1.com \
peer chaincode invoke peer0.org1.com -C "my-channel1" -n "chaincode1" -c '{"Args":["KVContract:get", "name"]}' \
--tls --cafile "/var/hyperledger/cli/crypto-orderer/tlsca.orderer.com-cert.pem"

@jerry-98
Copy link

jerry-98 commented Feb 8, 2022

Hi @Hejwo

Command:

docker exec cli.org1.com peer chaincode invoke peer0.org1.com -C "my-channel1" -n "chaincode1" -c '{"Args":["KVContract:put", "nameField", "Random Person"]}' --tls --cafile "/var/hyperledger/cli/crypto-orderer/tlsca.orderer.com-cert.pem"

Output :

2022-02-08 13:24:34.196 UTC 0001 INFO [chaincodeCmd] InitCmdFactory -> Retrieved channel (my-channel1) orderer endpoint: orderer0.group1.orderer.com:7030
2022-02-08 13:24:35.786 UTC 0002 INFO [chaincodeCmd] chaincodeInvokeOrQuery -> Chaincode invoke successful. result: status:200 payload:"{"success":"OK"}"

BUT

Command

docker exec cli.org1.com peer chaincode invoke peer0.org1.com -C "my-channel1" -n "chaincode1" -c '{"Args":["KVContract:get", "nameField"]}' --tls --cafile "/var/hyperledger/cli/crypto-orderer/tlsca.orderer.com-cert.pem"

Output
2022-02-08 13:25:15.943 UTC 0001 INFO [chaincodeCmd] InitCmdFactory -> Retrieved channel (my-channel1) orderer endpoint: orderer0.group1.orderer.com:7030
2022-02-08 13:25:16.252 UTC 0002 INFO [chaincodeCmd] chaincodeInvokeOrQuery -> Chaincode invoke successful. result: status:200 payload:"{"error":"NOT_FOUND"}"

THe asset is not being added to world state

@Hejwo
Copy link
Contributor

Hejwo commented Feb 8, 2022

ah, my bad - In your case another subtlety of Hyperledger Fabric is important:

docker exec cli.org1.com \
peer chaincode invoke peer0.org1.com -C "my-channel1" -n "chaincode1" -c '{"Args":["KVContract:get", "name"]}' \
--tls --cafile "/var/hyperledger/cli/crypto-orderer/tlsca.orderer.com-cert.pem" \
--waitForEvent

last flag ensures that we wait for response event. It also guarantees more verbose output. With it response is:

2022-02-08 17:37:27.303 UTC 0001 INFO [chaincodeCmd] InitCmdFactory -> Retrieved channel (my-channel1) orderer endpoint: orderer0.group1.orderer.com:7030
2022-02-08 17:37:29.395 UTC 0002 INFO [chaincodeCmd] ClientWait -> txid [a9a3f689c8110087a3409ce0e8e3418ad935166fee202b6789e8c8c4f478d6eb] committed with status (ENDORSEMENT_POLICY_FAILURE) at peer0.org1.com:7041
Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE) - proposal response: <nil>

Which is normal - default endorsement policy requires majority of organizations to approve transaction. It's not happening because we must list other org peers and their certificates.

@Hejwo
Copy link
Contributor

Hejwo commented Feb 8, 2022

So finally in your case you should execute:

docker exec cli.org1.com peer chaincode invoke \
--peerAddresses "peer0.org1.com:7041" --tlsRootCertFiles "/var/hyperledger/cli/crypto-peer/peer0.org1.com/tls/ca.crt" \
--peerAddresses "peer0.org2.com:7061" --tlsRootCertFiles "/var/hyperledger/cli/crypto-peer/peer0.org2.com/tls/ca.crt" \
--peerAddresses "peer0.org3.com:7081" --tlsRootCertFiles "/var/hyperledger/cli/crypto-peer/peer0.org3.com/tls/ca.crt" \
--peerAddresses "peer0.org4.com:7101" --tlsRootCertFiles "/var/hyperledger/cli/crypto-peer/peer0.org4.com/tls/ca.crt" \
-C "my-channel1" -n "chaincode1" \
-c '{"Args":["KVContract:put", "nameField", "Random Person"]}' \
--tls --cafile "/var/hyperledger/cli/crypto-orderer/tlsca.orderer.com-cert.pem" \
--waitForEvent
2022-02-08 18:22:48.056 UTC 0001 INFO [chaincodeCmd] InitCmdFactory -> Retrieved channel (my-channel1) orderer endpoint: orderer0.group1.orderer.com:7030
2022-02-08 18:22:50.130 UTC 0003 INFO [chaincodeCmd] ClientWait -> txid [3aed62fe482910421678580f4ae3afe0c1a65df518702f099bd7d148676361f4] committed with status (VALID) at peer0.org4.com:7101
2022-02-08 18:22:50.130 UTC 0002 INFO [chaincodeCmd] ClientWait -> txid [3aed62fe482910421678580f4ae3afe0c1a65df518702f099bd7d148676361f4] committed with status (VALID) at peer0.org1.com:7041
2022-02-08 18:22:50.135 UTC 0004 INFO [chaincodeCmd] ClientWait -> txid [3aed62fe482910421678580f4ae3afe0c1a65df518702f099bd7d148676361f4] committed with status (VALID) at peer0.org2.com:7061
2022-02-08 18:22:50.135 UTC 0005 INFO [chaincodeCmd] ClientWait -> txid [3aed62fe482910421678580f4ae3afe0c1a65df518702f099bd7d148676361f4] committed with status (VALID) at peer0.org3.com:7081
2022-02-08 18:22:50.135 UTC 0006 INFO [chaincodeCmd] chaincodeInvokeOrQuery -> Chaincode invoke successful. result: status:200 payload:"{\"success\":\"OK\"}" 

for query i would recommend not using invoke, but query. It's a good practice to read data from peer that way:

docker exec cli.org1.com \
peer chaincode query peer0.org1.com -C "my-channel1" -n "chaincode1" -c '{"Args":["KVContract:get", "nameField"]}' \
--tls --cafile "/var/hyperledger/cli/crypto-orderer/tlsca.orderer.com-cert.pem"
{"success":"Random Person"}

@jerry-98
Copy link

jerry-98 commented Feb 9, 2022

Thanks for guidance
I was using rest apis but want to use gateway and manage identities as described in basic-asset-transfer
I want to create my own apis and call various gateway and invocation features like in the assete-tranfer examples. The folder structures of fablo and the hf test-network are different. Can you help me with the same for creating wallet, paths, ccps, caclient etc as metioned in asset-transfer application-javascript so that I can create my own wallet and identities and utilise the fablo network beneath it to create my own apis.

@dzikowski
Copy link
Contributor

Thanks for your comment. We will continue this discussion about compatibility with Fabric samples in #285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants