Hazelcast: Single node cluster with invalid public address is not able to start on 3.12-SNAPSHOT

Created on 13 Feb 2019  路  3Comments  路  Source: hazelcast/hazelcast

Greetings.

I'm running the following example with a single node on both IMDG 3.11.1 and latest master and get different results. I know that the config is a bit weird, but I still would expect that the node should be able to start.

public static void main(String[] args) {
    Config config = new Config("hz1");
    config.getNetworkConfig()
          .setPublicAddress("127.0.0.2")
          .setPort(5701)
          .setPortAutoIncrement(false);
    config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
    config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true)
          .setMembers(Arrays.asList("127.0.0.1:5701"));

    HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
    System.out.println(">>> Started!!! <<<");
}

For 3.11.1 the node is able to start, while for latest master it outputs the following to the console in an infinite loop and does not start:

INFO: [127.0.0.2]:5701 [dev] [3.12-SNAPSHOT] Connecting to /127.0.0.1:5701, timeout: 0, bind-any: true
Feb 12, 2019 5:44:59 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.2]:5701 [dev] [3.12-SNAPSHOT] Initialized new cluster connection between /127.0.0.1:5701 and /127.0.0.1:43699
Feb 12, 2019 5:44:59 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
WARNING: [127.0.0.2]:5701 [dev] [3.12-SNAPSHOT] Wrong bind request from [127.0.0.2]:5701! This node is not the requested endpoint: [127.0.0.1]:5701
Feb 12, 2019 5:44:59 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.2]:5701 [dev] [3.12-SNAPSHOT] Initialized new cluster connection between /127.0.0.1:43699 and /127.0.0.1:5701
Feb 12, 2019 5:44:59 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.2]:5701 [dev] [3.12-SNAPSHOT] Connection[id=4, /127.0.0.1:5701->/127.0.0.1:43699, endpoint=null, alive=false, type=MEMBER] closed. Reason: Wrong bind request from [127.0.0.2]:5701! This node is not the requested endpoint: [127.0.0.1]:5701
Feb 12, 2019 5:44:59 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.2]:5701 [dev] [3.12-SNAPSHOT] Connection[id=3, /127.0.0.1:43699->/127.0.0.1:5701, endpoint=[127.0.0.1]:5701, alive=false, type=MEMBER] closed. Reason: Connection closed by the other side
Feb 12, 2019 5:45:00 PM com.hazelcast.nio.tcp.TcpIpConnector

I'm curious whether it's a known issue or just a change in the default behavior?

Internal Core Defect

All 3 comments

This change was originally done to prevent address spoofing, when you attempted binding with address A, but then your bind-request had a different remote address. This was indented behavior. Now, in 4.0, this is even more complex, spoofing is not the problem anymore but this creates a join loop to identify master.

I am not sure whether we should address something here, its not trivial to fail-fast every possible user-input in that config, and logging already helps to show that you are doing something wrong.

@mmedenjak thoughts?

I am not sure whether we should address something here, its not trivial to fail-fast every possible user-input in that config, and logging already helps to show that you are doing something wrong.

Makes sense. I agree that current behavior already illustrates that something is misconfigured.

Thanks for a late, but comprehensive answer. :)

Agree. This scenario does seem a bit contrived and the node is not able to detect that it's about to connect to itself (in the process identifying itself as another address).
Talking to Thomas, I don't see a real-world scenario where this kind of config was supposed to work and I don't know how to improve the message either. Let's close it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcelalburg picture marcelalburg  路  6Comments

rruxandra picture rruxandra  路  6Comments

varunsufi picture varunsufi  路  5Comments

kovalcikm picture kovalcikm  路  5Comments

hengyunabc picture hengyunabc  路  7Comments