iroha icon indicating copy to clipboard operation
iroha copied to clipboard

[BUG] RPC failed messages, while pings pass between containers

Open 6r1d opened this issue 2 years ago • 2 comments

Today, sungod reported an issue with Iroha 1 in the Hyperledger Iroha Community Telegram channel. While pings pass between the containers, there are RPC call errors in the logs, for example:

[2023-02-13 15:21:14.175082645][I][Irohad/Consensus/HashGate]: votingStep got vote: VoteMessage: [yac hash=YacHash: [round=Round: [block=3, reject=0], hashes=VoteHashes: [proposal=, block=]], signature=Signature: [publicKey=8da2d43a41008a79206be292a8298315b602591a2b85f74c3c0bbb9372211373, signedData=1e332cea27dbcc32fd2d58bad209ca96d54dbdb361d93b8dccf3cb0bb888d37c14b4e319a7202d995d8d064b9b6e55a5e92eb9be06519889b3577a66c7e56c0a]], attempt 199
[2023-02-13 15:21:14.175204983][I][Irohad/Consensus/HashGate]: Vote VoteMessage: [yac hash=YacHash: [round=Round: [block=3, reject=0], hashes=VoteHashes: [proposal=, block=]], signature=Signature: [publicKey=8da2d43a41008a79206be292a8298315b602591a2b85f74c3c0bbb9372211373, signedData=1e332cea27dbcc32fd2d58bad209ca96d54dbdb361d93b8dccf3cb0bb888d37c14b4e319a7202d995d8d064b9b6e55a5e92eb9be06519889b3577a66c7e56c0a]] to peer Peer: [address=172.18.0.23:50051, pubkey=8f014fa2b7832d25458ae68a541d51a1044f87afc5513967fda16e3728e68f61, tlsCertificate=0, IsSyncing=0]
[2023-02-13 15:21:14.175285652][I][Irohad/Consensus/Network]: Send votes bundle[size=1] for Round: [block=3, reject=0] to Peer: [address=172.18.0.23:50051, pubkey=8f014fa2b7832d25458ae68a541d51a1044f87afc5513967fda16e3728e68f61, tlsCertificate=0, IsSyncing=0]
[2023-02-13 15:21:14.175822911][W][Irohad/Consensus/Network]: RPC failed: ipv4:172.18.0.23:50051

It bay be either a bug or a configuration issue.

Who can help?

@iceseer @baziorek

6r1d avatar Feb 13 '23 15:02 6r1d

Today, sungod reported an issue

Hello this was me. So I am exploring iroha1 and learning its usage, so this might very well be a config issue and not a bug. What am I attempting is to create one iroha node initially and then adding a 2nd peer. Here are the steps I tried:

  1. docker network create --subnet=172.18.0.0/16 iroha-network

  2. docker volume create blockstore1

  3. docker volume create blockstore2

  4. Start postgres container: docker run --name some-postgres \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=mysecretpassword \ -p 5432:5432 \ --network=iroha-network \ --ip 172.18.0.22 \ -d postgres:9.5 \ -c 'max_prepared_transactions=100'

  5. Start iroha1: docker run --name iroha1 \ -d \ -p 50051:50051 \ -v $PWD/irohad-add-peer/iroha1:/opt/iroha_data \ -v blockstore1:/tmp/block_store \ --network=iroha-network \ --ip 172.18.0.23 \ -e KEY='iroha1' \ hyperledger/iroha:latest

  6. Exec into the container, create assets, add asset quantities etc (similar to https://iroha-1-fork.readthedocs.io/en/latest/getting_started/cli-guide.html#). Everything works and I see new blocks getting added inside /tmp/block_store of iroha1

  7. Start iroha2 docker run --name iroha2 \ -d \ -p 50052:50051 \ -v $PWD/irohad-add-peer/iroha2:/opt/iroha_data \ -v blockstore2:/tmp/block_store \ --network=iroha-network \ --ip 172.18.0.25 \ -e KEY='iroha2' \ hyperledger/iroha:latest

Note: According to https://iroha-1-fork.readthedocs.io/en/latest/maintenance/add_peer.html#usage, if there is only 1 peer running and we plan to add a 2nd peer, the "initial_peers" section of the 2nd peer must contain both the peer details. So I have modified irohad-add-peer/iroha2/config.docker to reflect this. You can do a diff of iroha1/config.docker and iroha2/config.docker to see what I mean.

  1. From iroha1, add iroha2 as a peer:
vagrant@ubuntu-jammy:~$ docker exec -it iroha1 /bin/bash
root@2f70c085af1a:/opt/iroha_data# iroha-cli -account_name admin@test
Welcome to Iroha-Cli.
Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 1
Forming a new transactions, choose command to add:
1. Detach role from account (detach)
2. Add new role to account (apnd_role)
3. Create new role (crt_role)
4. Set account key/value detail (set_acc_kv)
5. Transfer Assets (tran_ast)
6. Grant permission over your account (grant_perm)
7. Subtract Assets Quantity (sub_ast_qty)
8. Set Account Quorum (set_qrm)
9. Remove Signatory (rem_sign)
10. Create Domain (crt_dmn)
11. Revoke permission from account (revoke_perm)
12. Create Account (crt_acc)
13. Add Signatory to Account (add_sign)
14. Create Asset (crt_ast)
15. Add Peer to Iroha Network (add_peer)
16. Add Asset Quantity (add_ast_qty)
0. Back (b)
> : 15
Full address of a peer: 172.18.0.25:50051
Public Key: 8f014fa2b7832d25458ae68a541d51a1044f87afc5513967fda16e3728e68f61
Command is formed. Choose what to do:
1. Go back and start a new transaction (b)
2. Save as json file (save)
3. Add one more command to the transaction (add)
4. Send to Iroha peer (send)
> : 4
Peer address (127.0.0.1):
Peer port (50051):
[2023-02-14 04:47:23.209144379][I][CLI/ResponseHandler/Transaction]: Transaction successfully sent
Congratulation, your transaction was accepted for processing.
Its hash is f95d18efa4e5e28c455cdcc0e694d47365995fabc4bb2cf34a9b13faf674512c
--------------------
Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 3
Choose action:
1. Get status of transaction (get_tx_info)
0. Back (b)
> : 1
Requested tx hash: f95d18efa4e5e28c455cdcc0e694d47365995fabc4bb2cf34a9b13faf674512c
Tx hash is saved. Choose what to do:
1. Send to Iroha peer (send)
2. Save as json file (save)
0. Back (b)
> : 1
Peer address (127.0.0.1):
Peer port (50051):
Transaction was successfully committed.
  1. As you can see above, the transaction was successfully committed. But on iroha1 logs, I see failures: [2023-02-14 04:49:48.274038237][I][Irohad/Consensus/HashGate]: votingStep got vote: VoteMessage: [yac hash=YacHash: [round=Round: [block=4, reject=0], hashes=VoteHashes: [proposal=, block=]], signature=Signature: [publicKey=8da2d43a41008a79206be292a8298315b602591a2b85f74c3c0bbb9372211373, signedData=a8587f5c669a2dfcc557e86289637f228de8ffabab04abcd1694704fe9e35c537a17263215e38b36e7f8a59863a263ef621504717f56bf195a246ee1c3bdd80f]], attempt 27 [2023-02-14 04:49:48.274187572][I][Irohad/Consensus/HashGate]: Vote VoteMessage: [yac hash=YacHash: [round=Round: [block=4, reject=0], hashes=VoteHashes: [proposal=, block=]], signature=Signature: [publicKey=8da2d43a41008a79206be292a8298315b602591a2b85f74c3c0bbb9372211373, signedData=a8587f5c669a2dfcc557e86289637f228de8ffabab04abcd1694704fe9e35c537a17263215e38b36e7f8a59863a263ef621504717f56bf195a246ee1c3bdd80f]] to peer Peer: [address=172.18.0.25:50051, pubkey=8f014fa2b7832d25458ae68a541d51a1044f87afc5513967fda16e3728e68f61, tlsCertificate=0, IsSyncing=0] [2023-02-14 04:49:48.275659143][I][Irohad/Consensus/Network]: Send votes bundle[size=1] for Round: [block=4, reject=0] to Peer: [address=172.18.0.25:50051, pubkey=8f014fa2b7832d25458ae68a541d51a1044f87afc5513967fda16e3728e68f61, tlsCertificate=0, IsSyncing=0] [2023-02-14 04:49:48.278343715][W][Irohad/Consensus/Network]: RPC failed: ipv4:172.18.0.25:50051

  2. If I login to iroha2 and try to query the assets I created on iroha1 on step6, I don't see the values

docker exec -it iroha2 /bin/bash
root@bb8f4af63b31:/opt/iroha_data# iroha-cli -account_name admin@test
Welcome to Iroha-Cli.
Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 2
Choose query:
1. Get all permissions related to role (get_role_perm)
2. Get information about asset (get_ast_info)
3. Get all current roles in the system (get_roles)
4. Get Account's Signatories (get_acc_sign)
5. Get Account's Transactions (get_acc_tx)
6. Get Account's Asset Transactions (get_acc_ast_tx)
7. Get Transactions by transactions' hashes (get_tx)
8. Get Account's Assets (get_acc_ast)
9. Get Account Information (get_acc)
0. Back (b)
> : 8
Requested account Id: admin@test
Requested asset Id: coolcoin#test
Query is formed. Choose what to do:
1. Send to Iroha peer (send)
2. Save as json file (save)
0. Back (b)
> : 1
Peer address (127.0.0.1):
Peer port (50051):
[2023-02-14 04:51:56.885579656][I][CLI/ResponseHandler/Query]: [Account Assets]
  1. Additional info: There is no network issue since I am able to ping either container from each other using their IPs (172.18.0.23 and 172.18.0.25).

itisravi avatar Feb 14 '23 05:02 itisravi

irohad-add-peer.zip

Attachment containing the docker config files, genesis block, key files etc. for iroha1 and iroha2.

itisravi avatar Feb 14 '23 05:02 itisravi