Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config validation is broken #3257

Closed
pveentjer opened this issue Aug 14, 2014 · 3 comments · Fixed by #3300
Closed

Config validation is broken #3257

pveentjer opened this issue Aug 14, 2014 · 3 comments · Fixed by #3300
Assignees
Labels
Source: Internal PR or issue was opened by an employee Type: Defect
Milestone

Comments

@pveentjer
Copy link
Contributor

There is no good working validation of configuration when members join. See the following example:

public class Main {

    public static void main(String[] args){
        Config config1 = new Config();
        config1.setProperty(GroupProperties.PROP_PARTITION_COUNT,"100");
        Config config2 = new Config();

        HazelcastInstance hz1 = Hazelcast.newHazelcastInstance(config1);
        HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(config2);

        IMap map = hz1.getMap("map");
        for(int k=0;k<1000;k++){
            map.put(UUID.randomUUID().toString(),"10");
        }
        System.out.println("done");
    }
}

The following logging:

java.lang.ArrayIndexOutOfBoundsException: 100
    at com.hazelcast.partition.impl.InternalPartitionServiceImpl.allocateReplicas(InternalPartitionServiceImpl.java:568)
    at com.hazelcast.partition.impl.InternalPartitionServiceImpl.finalizeOrRollbackMigration(InternalPartitionServiceImpl.java:562)
    at com.hazelcast.partition.impl.InternalPartitionServiceImpl.processPartitionRuntimeState(InternalPartitionServiceImpl.java:545)
    at com.hazelcast.partition.impl.PartitionStateOperation.run(PartitionStateOperation.java:51)
    at com.hazelcast.spi.impl.BasicOperationService$OperationHandler.handle(BasicOperationService.java:672)
    at com.hazelcast.spi.impl.BasicOperationService$OperationHandler.access$400(BasicOperationService.java:648)
    at com.hazelcast.spi.impl.BasicOperationService$OperationPacketHandler.handle(BasicOperationService.java:622)
    at com.hazelcast.spi.impl.BasicOperationService$OperationPacketHandler.handle(BasicOperationService.java:590)
    at com.hazelcast.spi.impl.BasicOperationService$OperationPacketHandler.access$1400(BasicOperationService.java:577)
    at com.hazelcast.spi.impl.BasicOperationService$BasicDispatcherImpl.dispatch(BasicOperationService.java:532)
    at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.process(BasicOperationScheduler.java:439)
    at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.processPriorityMessages(BasicOperationScheduler.java:452)
    at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.doRun(BasicOperationScheduler.java:432)
    at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.run(BasicOperationScheduler.java:408)

But this exception is internal catched and logged; so the application keeps running.

@pveentjer
Copy link
Contributor Author

The Config.isCompatible is not called apart from in a unit test. So currently there is no validation.

@pveentjer
Copy link
Contributor Author

Apparently it is broken since Hazelcast 3.0.

In 2.x the whole config was send to the remote machine. In 3.x the ConfigCheck is used and the Config.isCompatible isn't used at all. The ConfigCheck doesn't cover enough fields to make it useful.

@enesakar enesakar added this to the 3.3 milestone Aug 14, 2014
@pveentjer
Copy link
Contributor Author

There is another bug.

If the cluster configuration doesn't match, instead of letting the joining member crash, it will create its own cluster. This is a violation of the fail fast principle. So we need to get this fixed as well.

pveentjer added a commit to pveentjer/hazelcast that referenced this issue Aug 18, 2014
pveentjer added a commit to pveentjer/hazelcast that referenced this issue Aug 18, 2014
Fixed the issue that not a lot of config validation is done. It also fixes the issue
that in some cases instart of shutting down the node, due to the config conflict, a
seperate cluster is created.

This patch doesn't contains logic for structural checking of conflicts for map/queue
etc. But it does contain all the infrastructure.

It also contains the feature where a user can provide a 'token' to that needs to be
the same on all members. E.g. filepath or other configuration settings. This can be
done through the hazelcast.application.validation.token system property.
@mmedenjak mmedenjak added the Source: Internal PR or issue was opened by an employee label Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Internal PR or issue was opened by an employee Type: Defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants