hazelcast / hazelcast-wm

Hazelcast filter-based Web Session Manager
Other
12 stars 31 forks source link

Fix #62 #76

Closed enozcan closed 4 years ago

enozcan commented 4 years ago

The related issue is #62.

When deferred-write is enabled, the problem occurs in the following scenario:

  1. HazelcastHttpSession#getAttribute(some_attr) creates a local cache entry with null value. This entry is marked as non-transient regardless of it is transient entry or not. https://github.com/hazelcast/hazelcast-wm/blob/c25e35ac06fe18f43323782238005b9944f4ed53/src/main/java/com/hazelcast/web/HazelcastHttpSession.java#L116
  2. HazelcastHttpSession#setAttribute(some_attr) marks this entry as dirty and at the end of the request, HazelcastHttpSession#sessionDeferredWrite method writes this attribute to distributed map since being dirty && !transient

This is not the case when deferred-write = false.

If deferred-write is disabled, the following check prevents the entry to be stored in the distributed map since transient flag is properly set in the method: https://github.com/hazelcast/hazelcast-wm/blob/c25e35ac06fe18f43323782238005b9944f4ed53/src/main/java/com/hazelcast/web/HazelcastHttpSession.java#L97