You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: