gitmachtl / scripts

StakePool Operator Scripts. Learn how to create and manage your StakePool / manage your DRep stuff / do Governance Actions with these simple scripts. Hardware-Ledger/Trezor Support, Token/Asset Sending, Offline-Mode and much more...
MIT License
271 stars 95 forks source link

Error with workaround on get_currentTip function #28

Closed kaverne closed 3 years ago

kaverne commented 3 years ago

Context:

I was just refreshing the metadata of my pool so going through

  1. 05a_genStakepoolCert.sh => All went fine
  2. 05c_regStakepoolCert.sh => Problem happened

I was getting an error on the second step on 00_common.sh line 334 This is where get_currentTip assignation lies, it wasn't being able to fetch the current tip. Receiving the error "query tip return from cardano-cli failed", the value of currentTip was "".

Exact problem

I pass you all the debug but running the steps manually the same exact way it turns out that cardano-cli was working fine, but as soon as you would pipe jq to cardano-cli you would receive a MuxError (MuxIOException writev: resource vanished (Broken pipe)) as per code

local currentTip=$(${cardanocli} query tip ${magicparam} 2> /dev/null | jq -r .slot 2> /dev/null)

Workaround

As everything else was going fine and I had to go through it I simply bypassed jq and did a dirty (but working) bypass.

${cardanocli} query tip ${magicparam} 2> /dev/null > /tmp/current.tip
local currentTip=$(cat /tmp/current.tip | jq -r .slot 2> /dev/null)

Not a rockstar script but it did the trick and got me through it. It also did prove the point that there is some sort of wrong interaction between cardano-cli and jq ???

Extra Info

$ cardano-cli --version cardano-cli 1.30.1 - linux-aarch64 - ghc-8.10 git rev 0fb43f4e3da8b225f4f86557aed90a183981a64f $ jq --version jq-1.6 $ uname -a Linux ip-10-0-0-31 5.11.0-1020-aws #21~20.04.2-Ubuntu SMP Fri Oct 1 13:01:34 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

I can't really explain it, this is systematically happening on my utility node that only exist for the time of typing command and is then destroyed. This query tip / jq error is not happening on my production nodes with the same cardano-cli but a different ubuntu

$ uname -a Linux ip-10-0-0-126 5.11.0-1019-aws #20~20.04.1-Ubuntu SMP Tue Sep 21 10:41:13 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

conclusion

Anyway, it's not your script being really in trouble here but for a better customer service perhaps using a middle buffer for this command might make sense. You tool, your choice. Thanks again for the good work and the service. Keep up the good work !

gitmachtl commented 3 years ago

hi, yes, this is a problem with the current version of cardano-node/cli. it sometimes just not returns values on a query. do you use the latest version of the 00_common.sh file? i implemented a temporary simple workaround (https://github.com/gitmachtl/scripts/blob/3345c154e4122d7518309fdc89215aea338e38ad/cardano/mainnet/00_common.sh#L331-L341) in there to request the tip max. 3 times in a row, this normally solves the current issue with the cli. hopefully they fix the cardano-cli with future releases regarding to this, we have reported this issue a long time ago.

gitmachtl commented 3 years ago

this is the issue report, feel free to vote it up: https://github.com/input-output-hk/cardano-node/issues/3042

kaverne commented 3 years ago

Thanks for the link and the answer. Well yes I got the latest, I pull the latest on node provisioning. But for some reason on this node it fails 100%. I'll vote the issue up ;-)

gitmachtl commented 3 years ago

ah yes i see that you got the error message, yep, it's an cli issue right now. but you should be able to solve it by just running the script again.

gitmachtl commented 3 years ago

solved with the upcoming nodeversion 1.31.0 -> https://github.com/input-output-hk/cardano-node/issues/3042#issuecomment-960562013