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

Map (IMap) Corrupting/Losing data when there is competition at task startup #26317

Open
vinicius-colutti opened this issue Apr 20, 2024 · 0 comments

Comments

@vinicius-colutti
Copy link
Contributor

Describe the bug

When there is competition at task startup on Java HazelcastInstance, to form the server cluster, the Map are corrupting, as if the information/positions were removed from the map.

I got this situation, in AWS ECS environment, using ECS discovery to create the cluster of Hazelcast instances.

And then, I was able to replicate this situation in my local environment, using the simple Hazelcast instances.

Below, I will explain how to replicate the problem.

Expected behavior

Not corrupt the map, when one or more tasks are initializing in the same moment.

To Reproduce

I disposed a sample application to test this problem: https://github.com/vinicius-colutti/hazelcast-map-trade-off

Lang, framework and versions

Lang: Java17
Framework: spring-boot-starter-web 3.1.10
Hazelcast: 5.4.0

What does this application do?

1. This application create a simple Hazelcast Instance as a bean
image

2. Have a controller to get full map and populate the map
image

3. When the application started, I get the map to check size and show the keys-values
image

To Reproduce the problem

1. Cluster three tasks in a Hazelcast cluster (differentiating only the HTTP and TCP port on which each node will run)
image

2. Then, I populate the map with 10 objects, calling the Hazelcast port 5701 node (or any other)
image

3. I check if all members have the complete map by calling the HTTP request /getMap
image
image
image

4. So I stop two cluster nodes
5. Then I start both nodes again, pretty much at the same time
6. We can already see at startup that the map is no longer complete. We can also see that when I make HTTP requests, the map already responds with another size.
No matter which node I make requests to, they will all return the same size and the same objects.
image
image
image

7. If we repeat the process of stopping the nodes and starting them again, practically at the same time, we can observe the map becoming corrupted again, and in the test carried out the map had only two objects.
image
image
image
image
image

Additional context

With ReplicatedMap, this problem not occurred.

Regarding Map, I didn't find any information in the documentation saying that this is an expected or common situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant