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

Error (sometimes) occurs while deserializing the session.notes #119

Open
rik-overvelde opened this issue Dec 9, 2021 · 0 comments
Open

Comments

@rik-overvelde
Copy link

Hello,

I'm trying to get Hazelcast session replication up and running for an existing application running under tomcat9. I'm using the hazelcast-tomcat9-sessionmanager, with sticky="false".
However, I sometimes get an issue where a session can no longer be deserialized because of the ofllowing error:
com.hazelcast.nio.serialization.HazelcastSerializationException: Problem while reading DataSerializable, namespace: 0, ID: 0, class: 'com.hazelcast.session.HazelcastSession', exception: Illegal initial capacity: -2147483648

Some debugging has made me come to the conclusion that the problem lies with the session.notes map (Originally a hashtable). When deserializing the map, it find a mapSize (or initial load) of '1886388339'. When initializing the hashmap, Java uses the following calculation to determine the initial map size : (initialLoad / 0.75) + 1. The +1 leads to an overflow, so that it tries to initialize the map with a negative value.

Sadly, I haven't found out yet what happens that causes the session to get serialized with this map size. This seems rather random right now. A workaround might be to limit the mapSize to a max value of '1886388338' so that the map will always be initialized with the right value.

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

No branches or pull requests

1 participant