xuperchain / xuperchain

A highly flexible blockchain architecture with great transaction performance.

Home Page:https://xuper.baidu.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed when starting with set address as node public IP in conf/network.yaml

zhugelianglongming opened this issue · comments

commented

Brief of the issue
Set address in conf/network.yaml as node public IP, result in failure when staring.

Your environment

  • XuperChain: v5.3.0
  • OS: Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-1023-azure x86_64)
  • Go: go1.18.1 linux/amd64
  • Gcc: 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

Repo steps

  1. Download Xuperchain v5.3.0
  2. make && make testnet
  3. Configurate address in testnet/<Node>/conf/network.yaml
# Address multiaddr string
address: /ip4/<NodePublicIP>/tcp/47101
  1. cd testnet/<Node> && bash control.sh start

Expected behaviours

...
start finish.pid:<PID>
Done!

What actually happened

...
..........start timeout
start timeout,force stop app.
force stop xchain.
force stop succ
start fail.

Additional information

  • set address to below will work
    • 127.0.0.1
    • 0.0.0.0
    • Local IP

Set STD debug log enabled, then got:

<Time> lvl=eror msg="Create p2p host error" module=xchain log_id=1669809433_7959671397435886 s_mod=network call=server.go:117 pid=25002 error="failed to listen on any addresses: [listen tcp4 <NodePublicIP>:47101: bind: cannot assign requested address]"
<Time> start service failed.err:init engine error: Err:500-50100-create engine context failed+create network failed.err:create network object failed.err:new network failed because init p2p service error.err:create host error
commented

Reason:

  • The so-called NodePublicIP is a public EIP in cloud provider, but not an actual IP for the node.

How to find all IPs for a node:

  • Linux: ip address | grep inet | awk '{print $2}'
  • MacOS: ifconfig | grep inet | awk '{print $2}'

Solution:

  • Set address with node's IP
commented

The useful logs only exist in debug STD log, it's difficult for debugging.
It supposed to be printed in log file. Otherwise, it seems that the program quits silently.