polkadot-js / tools

Various cli tools for Polkadot and Substrate chains, including basic node monitoring, making API queries via a cli app and other command-line tools
Apache License 2.0
279 stars 69 forks source link

jacogr/polkadot-js-tools metadata tool - abnormal closure error #486

Open ghzlatarev opened 1 year ago

ghzlatarev commented 1 year ago

We have a CI workflow that is supposed to use the metadata diff tool to check whether we need to bump transaction_version of our runtime. Pretty much identical to https://github.com/paritytech/polkadot/blob/master/.github/workflows/release-21_extrinsic-ordering-check-from-two.yml Yesterday I noticed our own workflow is failing with the following error:

2023-04-07 05:17:20          API-WS: disconnected from ws://localhost:9944: 1006:: connection failed
2023-04-07 05:17:20          API-WS: disconnected from ws://localhost:9955: 1006:: connection failed
2023-04-07 05:17:23          API-WS: disconnected from ws://localhost:9944: 1006:: connection failed
2023-04-07 05:17:23          API-WS: disconnected from ws://localhost:9955: 1006:: connection failed

I tested locally on my machine by running 2 nodes and the following

docker pull jacogr/polkadot-js-tools
docker run --pull always --network host jacogr/polkadot-js-tools metadata ws://localhost:9945 ws://localhost:9944

And reproduced the error

jacogr commented 1 year ago

The 1006 is coming from the RPC node. The docker tooling is only reporting that there has been a closure. There is nothing code-wise that can be done, the above is local setup related.

ghzlatarev commented 1 year ago

Do you have any suggestions what to look at, I'm a little lost? I can reproduce it on fresh ubuntu AWS instance and locally on a Mac, and I can connect to this node through the browser polkadot-js front-end locally. I would've expected that to fail as well.

wilwade commented 1 year ago

@ghzlatarev I am testing a solution: Use host.docker.internal instead of localhost.

Testing it out now for our own upgrade. It also means you can remove --network host

docker run --pull always jacogr/polkadot-js-tools:0.55.3 metadata ws://host.docker.internal:9946 ws://host.docker.internal:9944

Should know if it works later today.

wilwade commented 1 year ago

@ghzlatarev Looks like that was a bust. So host.docker.internal alone is not the answer.

wilwade commented 1 year ago

@ghzlatarev

Found a solution:

I don't know why, but the docker is just not connecting to the host network (or not the right/same one at least).

I just created a new docker network and ran the node in the docker. It is actually nice in a few ways, but it solved the issue for me.