hazelcast / hazelcast-wm

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

Sessions map entries not removing when session-fixation-protection is "migrateSession" #72

Open boroda4436 opened 5 years ago

boroda4436 commented 5 years ago

Faced with the problem that sessions map is not cleaning completely when sessions expire. Looks like issue is not resolved completely.

In the debug mode I am able to see that original session in the hz session is invalid, but is still present in the sessions ConcurrentHashMap:

((Session)((HazelcastHttpSession)((java.util.concurrent.ConcurrentHashMap.MapEntry)sessions.entrySet().toArray()[0]).getValue()).originalSession)._state == INVALID

in this case
private final ConcurrentMap<String, HazelcastHttpSession> sessions = new ConcurrentHashMap(1000) will grow in the size and will cause memory leak.

The requests with basic auth hit this method (after successful basic authentication):

` package org.springframework.security.web.authentication.session;

abstract class AbstractSessionFixationProtectionStrategy implements SessionAuthenticationStrategy, ApplicationEventPublisherAware { ... /**

Conf: <hazelcastVersion 3.8.3 /hazelcastVersion> <springVersion 4.3.7.RELEASE springVersion> <springSecurityVersion 4.2.3.RELEASE springSecurityVersion>