3

I'm running the Chapter 3 Infinispan example from Julien Ponge's book "Vert.x In Action" on MacOS 11.3. https://github.com/jponge/vertx-in-action/tree/master/chapter3

public class FirstInstance {
    private static final Logger logger = LoggerFactory.getLogger(FirstInstance.class);

    public static void main(String[] args) {
        Vertx.clusteredVertx(new VertxOptions(), ar -> {
            if (ar.succeeded()) {
                logger.info("First instance has been started");
                Vertx vertx = ar.result();
                vertx.deployVerticle("chapter3.HeatSensor", new DeploymentOptions().setInstances(4));
                vertx.deployVerticle("chapter3.HttpServer");
            } else {
                logger.error("Could not start", ar.cause());
            }
        });
    }
}

After downloading the sample code, inside the chapter3 folder I do

./gradlew run -PmainClass=chapter3.cluster.FirstInstance -Pjvmargs="-Djava.net.preferIPv4Stack=true"

This results in

failed sending discovery request to /228.6.7.8:46655

This is working in Windows. I wonder if there is an issue with MacOS multicasting? I tried following these steps to enable multicasting but still get the same error: https://blogs.agilefaqs.com/2009/11/08/enabling-multicast-on-your-macos-unix/

Full output:

News-MacBook-Pro:chapter3f newuser$ ./gradlew run -PmainClass=chapter3.cluster.FirstInstance

> Task :run
DEBUG [main] LoggerFactory - Using io.vertx.core.logging.SLF4JLogDelegateFactory
WARN [vert.x-worker-thread-0] InfinispanClusterManager - Cannot find Infinispan config 'infinispan.xml', using default
WARN [vert.x-worker-thread-0] CONFIG - ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
INFO [vert.x-worker-thread-0] CONTAINER - ISPN000128: Infinispan version: Infinispan 'Corona Extra' 11.0.5.Final
INFO [vert.x-worker-thread-0] CLUSTER - ISPN000078: Starting JGroups channel ISPN with stack jgroups
ERROR [jgroups-6,News-MacBook-Pro-2273] MPING - News-MacBook-Pro-2273: failed sending discovery request to /228.6.7.8:46655
java.io.IOException: Can't assign requested address
        at java.base/java.net.PlainDatagramSocketImpl.send(Native Method)
        at java.base/java.net.DatagramSocket.send(DatagramSocket.java:695)
        at org.jgroups.protocols.MPING.sendMcastDiscoveryRequest(MPING.java:286)
        at org.jgroups.protocols.PING.sendDiscoveryRequest(PING.java:63)
        at org.jgroups.protocols.PING.findMembers(PING.java:31)
        at org.jgroups.protocols.Discovery.invokeFindMembers(Discovery.java:217)
        at org.jgroups.protocols.Discovery.lambda$findMembers$0(Discovery.java:228)
        at org.jgroups.protocols.Discovery$$Lambda$380.000000009D98CA20.run(Unknown Source)
        at org.jgroups.util.TimeScheduler3$Task.run(TimeScheduler3.java:328)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:831)
ERROR [jgroups-6,News-MacBook-Pro-2273] MPING - News-MacBook-Pro-2273: failed sending discovery request to /228.6.7.8:46655
java.io.IOException: Can't assign requested address
        at java.base/java.net.PlainDatagramSocketImpl.send(Native Method)
        at java.base/java.net.DatagramSocket.send(DatagramSocket.java:695)
        at org.jgroups.protocols.MPING.sendMcastDiscoveryRequest(MPING.java:286)
        at org.jgroups.protocols.PING.sendDiscoveryRequest(PING.java:63)
        at org.jgroups.protocols.PING.findMembers(PING.java:31)
        at org.jgroups.protocols.Discovery.invokeFindMembers(Discovery.java:217)
        at org.jgroups.protocols.Discovery.lambda$findMembers$0(Discovery.java:228)
        at org.jgroups.protocols.Discovery$$Lambda$380.000000009D98CA20.run(Unknown Source)
        at org.jgroups.util.TimeScheduler3$Task.run(TimeScheduler3.java:328)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:831)
ERROR [jgroups-6,News-MacBook-Pro-2273] MPING - News-MacBook-Pro-2273: failed sending discovery request to /228.6.7.8:46655
java.io.IOException: Can't assign requested address
        at java.base/java.net.DatagramSocket.send(DatagramSocket.java:695)
        at org.jgroups.protocols.MPING.sendMcastDiscoveryRequest(MPING.java:286)
        at org.jgroups.protocols.PING.sendDiscoveryRequest(PING.java:63)
        at org.jgroups.protocols.PING.findMembers(PING.java:31)
        at org.jgroups.protocols.Discovery.invokeFindMembers(Discovery.java:217)
        at org.jgroups.protocols.Discovery.lambda$findMembers$0(Discovery.java:228)
        at org.jgroups.protocols.Discovery$$Lambda$380.000000009D98CA20.run(Unknown Source)
        at org.jgroups.util.TimeScheduler3$Task.run(TimeScheduler3.java:328)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:831)
INFO [vert.x-worker-thread-0] GMS - News-MacBook-Pro-2273: no members discovered after 2003 ms: creating cluster as coordinator
INFO [vert.x-worker-thread-0] CLUSTER - ISPN000094: Received new cluster view for channel ISPN: [News-MacBook-Pro-2273|0] (1) [News-MacBook-Pro-2273]
INFO [vert.x-worker-thread-0] CLUSTER - ISPN000079: Channel ISPN local address is News-MacBook-Pro-2273, physical addresses are [192.168.0.101:7800]
INFO [vert.x-eventloop-thread-0] FirstInstance - First instance has been starte
INFO [vert.x-eventloop-thread-5] threads - JBoss Threads version 2.3.3.Final
ERROR [jgroups-5,News-MacBook-Pro-2273] MPING - News-MacBook-Pro-2273: failed sending discovery request to /228.6.7.8:46655
java.io.IOException: Can't assign requested address
        at java.base/java.net.DatagramSocket.send(DatagramSocket.java:695)
        at org.jgroups.protocols.MPING.sendMcastDiscoveryRequest(MPING.java:286)
        at org.jgroups.protocols.PING.sendDiscoveryRequest(PING.java:63)
        at org.jgroups.protocols.PING.findMembers(PING.java:31)
        at org.jgroups.protocols.Discovery.invokeFindMembers(Discovery.java:217)
        at org.jgroups.protocols.Discovery.findMembers(Discovery.java:244)
        at org.jgroups.protocols.Discovery.down(Discovery.java:387)
        at org.jgroups.protocols.MERGE3$InfoSender.run(MERGE3.java:412)
        at org.jgroups.util.TimeScheduler3$Task.run(TimeScheduler3.java:328)
        at org.jgroups.util.TimeScheduler3$RecurringTask.run(TimeScheduler3.java:362)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:831)
ERROR [jgroups-6,News-MacBook-Pro-2273] MPING - News-MacBook-Pro-2273: failed sending discovery request to /228.6.7.8:46655
java.io.IOException: Can't assign requested address
        at java.base/java.net.DatagramSocket.send(DatagramSocket.java:695)
        at org.jgroups.protocols.MPING.sendMcastDiscoveryRequest(MPING.java:286)
        at org.jgroups.protocols.PING.sendDiscoveryRequest(PING.java:63)
        at org.jgroups.protocols.PING.findMembers(PING.java:31)
        at org.jgroups.protocols.Discovery.invokeFindMembers(Discovery.java:217)
        at org.jgroups.protocols.Discovery.findMembers(Discovery.java:244)
        at org.jgroups.protocols.Discovery.down(Discovery.java:387)
        at org.jgroups.protocols.MERGE3$InfoSender.run(MERGE3.java:412)
        at org.jgroups.util.TimeScheduler3$Task.run(TimeScheduler3.java:328)
        at org.jgroups.util.TimeScheduler3$RecurringTask.run(TimeScheduler3.java:362)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:831)
Francis Huang
  • 550
  • 5
  • 6

1 Answers1

1

@tsegismont provided the answer which worked. https://gist.github.com/rafaeltuelho/208568668e4205bd9b93

Adds a multicast route for 224.0.0.1-231.255.255.254:

sudo route add -net 224.0.0.0/5 127.0.0.1

Adds a multicast route for 232.0.0.1-239.255.255.254

sudo route add -net 232.0.0.0/5 192.168.1.3

So for 230.0.0.0 I bind to 192.168.1.3

Francis Huang
  • 550
  • 5
  • 6