Error: Unable to bind to 0.0.0.0:4373 on this computer.

+4 votes
I had to reboot main node of my multichain that's been running fine for many months. There were 20 nodes connected. After reboot I did the normal to fire up the chain again:

nohup multichaind chain1 -daemon &

But I now get the following error:

MultiChain 1.0 Daemon (protocol 10008)

MultiChain server starting

Error: Unable to bind to 0.0.0.0:4373 on this computer. MultiChain Core is probably already running.

Error: Failed to listen on any port. Use -listen=0 if you want this.

---

However, node 2 can connect fine and use API commands in interactive mode just fine. Node 1 is centralized API for our external systems so our block explorer, etc are not working now.

Node 2 and subsequent nodes connect just fine. Just node 1 is having the error.

I can go into interactive mode on node 1 as well but then I get errors:

$ multichain-cli chain1

MultiChain 1.0 RPC client

Interactive mode

chain1: getinfo
error: couldn't connect to server
 

I tried rebooting node 1 several times but same issue persists. I can restart the chain from node 2 but node 1 just won't connect. What's going on?
asked Oct 28, 2017 by Matthew
I also stopped the chain running on node 2 and tried to start it from node 1. No love.

What now?

1 Answer

+1 vote

It sounds like you may already have another copy of MultiChain running on the same computer. If you're using Linux can check this by using ps -x. In any event, the solution to this is to set a different port and/or rpcport on the command-line options, so the two nodes don't try to listen on the same TCP/IP ports. Or use the multichain.conf file to set these more permanently, in a way that multichain-cli can automatically read.

answered Oct 29, 2017 by MultiChain
This is my output from ps -x

~$ ps -x
  PID TTY      STAT   TIME COMMAND
 1284 ?        Ss     0:00 /lib/systemd/systemd --user
 1286 ?        S      0:00 (sd-pam)
 1341 ?        R      0:00 sshd: ubuntu@pts/0
 1342 pts/0    Ss     0:00 -bash
 5061 pts/0    R+     0:00 ps -x

 I don't want two copies of Multichain running. How do I stop one so I can connect my api again?

Will you please clarify what you mean below?

" In any event, the solution to this is to set a different port and/or rpcport on the command-line options, so the two nodes don't try to listen on the same TCP/IP ports. Or use the multichain.conf file to set these more permanently, in a way that multichain-cli can automatically read."
Anyone there? How do I stop the chain from running when it won't respond to cli commands?
So maybe it's not because MultiChain is running. But some process seems to be binding to that port 4373. On Linux you can find out which by running this command under root:

lsof -i TCP
It's running because I can enter interactive mode. But then it says "error: couldn't connect to server" when i try to run any cli command.

When I run lsof -i TCP on root (Ubuntu) I get no output at all. It just gives new line.
OK, so you may need a different command. If you Google this you can find some ideas:

ubuntu check open ports

Or there will be some other reason why MultiChain can't bind to the port, perhaps a new set of firewall rules.
I can't find anything that's helping. This seems crazy I can't get this working.
You guys have no solution for this?

We don't have any firewall rules now and still nothing.
Did you try a simple reboot of the server to quit whatever may be hogging the port?

You can also try setting different values for the port and rpcport runtime parameters, to see if this is some general problem, or the port is genuinely tied up. Like:

multichaind chain1 -daemon -port=4567 -rpcport=4568

Then when you run multichain-cli, use:

multichain-cli -rpcport=4568 chain1
...