1

I deployed the HTTP Session management on WebShpere application as Peer to Peer model. I am trying to reset the defalut session timeout using cache-peer.xml file. However, it shows below error message.

java.lang.RuntimeException: EntryIdleTimeout is not the same
    at com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation.sameAs(RegionAttributesCreation.java:391) ~[gemfire-8.0.0.jar:na]
    at com.gemstone.gemfire.modules.util.RegionHelper.validateRegion(RegionHelper.java:67) ~[gemfire-modules-8.0.jar:na]
    at com.gemstone.gemfire.modules.session.common.PeerToPeerSessionCache.createOrRetrieveRegion(PeerToPeerSessionCache.java:130) ~[gemfire-modules-session-8.0.jar:na]
    at com.gemstone.gemfire.modules.session.common.PeerToPeerSessionCache.initialize(PeerToPeerSessionCache.java:72) ~[gemfire-modules-session-8.0.jar:na]
    at com.gemstone.gemfire.modules.session.filter.GemfireSessionManager.initializeSessionCache(GemfireSessionManager.java:415) ~[gemfire-modules-session-8.0.jar:na]
    at com.gemstone.gemfire.modules.session.filter.GemfireSessionManager.start(GemfireSessionManager.java:132) ~[gemfire-modules-session-8.0.jar:na]
    at com.gemstone.gemfire.modules.session.filter.SessionCachingFilter.init(SessionCachingFilter.java:536) ~[gemfire-modules-session-external-8.0.jar:na]

Cache-peer.xml

<region name="gemfire_modules_sessions">
<region-attributes scope="distributed-ack" enable-gateway="false" data policy="replicate" statistics-enabled="true">
<entry-idle-time>
  <expiration-attributes timeout="600" action="invalidate"/>       
</entry-idle-time>
</region-attributes>
</region>

Any idea? I could not find the defalut setting.

Stefan Ferstl
  • 5,135
  • 3
  • 33
  • 41
Napo
  • 263
  • 4
  • 14

1 Answers1

1

You should not use the region definition to control expiration, but rather the standard deployment descriptor semantics. For example in web.xml:

<session-config>
    <!-- set session TTL to 30 seconds -->
    <session-timeout>30</session-timeout>
</session-config>

The session expiration is still controlled by the native container which will emit the appropriate events when a session is created/destroyed. The GemFire HTTP Session Module registers a SessionListener and picks up these events, destroying the underlying cached session as necessary.

You can also set the TTL on an individual session through the Servlet API with:

HttpSession session = request.getSession();
session.setMaxInactiveInterval(30);
Jens D
  • 4,229
  • 3
  • 16
  • 19
  • I find Gemfire destroied session after 1:30 minutes when I set is 1 minute. Is it possible to make more accurate? – Napo Jun 12 '15 at 08:58
  • It probably depends on your container. Typically there is a reaping thread that runs periodically to destroy any expired sessions. I know that on Tomcat this runs every 60 seconds and is tunable. I don't know about JBoss. – Jens D Jun 14 '15 at 14:43
  • If the session expiration is still controlled by the native container, how to work with session stickiness environment? Like JSession A is generated by server1, but request go to server2. – Napo Jun 15 '15 at 01:27
  • GemFire uses it's own session ID value and maps that to an arbitrary native container session. If a request comes in to a server which has never seen the request before, the session is retrieved from the cache and associated with a local native container session. – Jens D Jun 16 '15 at 04:38