iotaledger / iri

IOTA Reference Implementation
Other
1.15k stars 370 forks source link

Bug: ZMQ makes nodes fail to start with multiple nodes on one server #1676

Open DyrellC opened 4 years ago

DyrellC commented 4 years ago

Bug description

When starting multiple nodes on the same IP with zmq enabled, every node after the first one will fail. This is the case when not using Docker, and may also be an issue when running docker as well.

IRI version

1.8.2

Hardware Spec

Asus f556U 8GB RAM 1TB - Linux

Steps To Reproduce

  1. Start two nodes on one machine with zmq enabled

Expected behaviour

Multiple nodes should be able to start and use the different ports for pub/sub.

Actual behaviour

Only one zmq enabled node can be run at a time on the same ip

Errors

11/28 09:30:27.846 [main] ERROR IRI$IRILauncher:141 - Exception during IOTA node initialisation: 
org.zeromq.ZMQException: Errno 48
    at org.zeromq.ZMQ$Socket.mayRaise(ZMQ.java:2744) ~[iri-1.8.2.jar:1.8.2]
    at org.zeromq.ZMQ$Socket.bind(ZMQ.java:2479) ~[iri-1.8.2.jar:1.8.2]
    at com.iota.iri.zmq.MessageQ.<init>(MessageQ.java:58) ~[iri-1.8.2.jar:1.8.2]
    at com.iota.iri.zmq.MessageQ.createWith(MessageQ.java:43) ~[iri-1.8.2.jar:1.8.2]
    at com.iota.iri.zmq.ZmqMessageQueueProvider.<init>(ZmqMessageQueueProvider.java:27) ~[iri-1.8.2.jar:1.8.2]
    at com.iota.iri.Iota.initializeTangle(Iota.java:285) ~[iri-1.8.2.jar:1.8.2]
    at com.iota.iri.Iota.init(Iota.java:180) ~[iri-1.8.2.jar:1.8.2]
    at com.iota.iri.IRI$IRILauncher.main(IRI.java:135) ~[iri-1.8.2.jar:1.8.2]
    at com.iota.iri.IRI.main(IRI.java:64) [iri-1.8.2.jar:1.8.2]
Exception in thread "main" org.zeromq.ZMQException: Errno 48 : Address already in use
    at org.zeromq.ZMQ$Socket.mayRaise(ZMQ.java:2744)
    at org.zeromq.ZMQ$Socket.bind(ZMQ.java:2479)
    at com.iota.iri.zmq.MessageQ.<init>(MessageQ.java:58)
    at com.iota.iri.zmq.MessageQ.createWith(MessageQ.java:43)
    at com.iota.iri.zmq.ZmqMessageQueueProvider.<init>(ZmqMessageQueueProvider.java:27)
    at com.iota.iri.Iota.initializeTangle(Iota.java:285)
    at com.iota.iri.Iota.init(Iota.java:180)
    at com.iota.iri.IRI$IRILauncher.main(IRI.java:135)
    at com.iota.iri.IRI.main(IRI.java:64)
11/28 09:30:27.854 [Shutdown Hook] INFO  IRI$IRILauncher:152 - Shutting down IOTA node, please hold tight...
11/28 09:30:27.855 [Shutdown Hook] INFO  Tangle:74 - Shutting down Tangle Persistence Providers... 
11/28 09:30:27.859 [Shutdown Hook] INFO  Tangle:77 - Shutting down Tangle MessageQueue Providers... 
luca-moser commented 4 years ago

Did you also make sure to change ZMQ_IPC?

GalRogozinski commented 4 years ago

So the solution to this bug is a better log message that will notify whether the failure is due to TCP or IPC binding