Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7780

Geode session management could update a stale state and cause some session attributes to be lost if enableLocalCache is set to true

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: http session
    • Labels:
      None

      Description

      I have analyzed the test failure (https://issues.apache.org/jira/browse/GEODE-7753) and found out the cause.

      What happened is that for every session get (get through geode client local caching), geode session management will do a put of that session to reset the lastAccessTime on all servers and local caches used by Tomcat servers.

      Please see the code below:

        public void commit() {
          if (!isValidInternal())
            throw new IllegalStateException("commit: Session " + getId() + " already invalidated");
          // (STRING_MANAGER.getString("deltaSession.commit.ise", getId()));
      
          synchronized (this.changeLock) {
            // Jens - there used to be a check to only perform this if the queue is
            // empty, but we want this to always run so that the lastAccessedTime
            // will be updated even when no attributes have been changed.
            DeltaSessionManager mgr = (DeltaSessionManager) this.manager;
            if (this.enableGatewayDeltaReplication && mgr.isPeerToPeer()) {
              setCurrentGatewayDeltaEvent(
                  new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, this.eventQueue));
            }
            this.hasDelta = true;
            this.applyRemotely = true;
            putInRegion(getOperatingRegion(), true, null);
            this.eventQueue.clear();
          }
        }
      

      However, because this is a client local cache, the get could have stale data (some delta updates have not been delivered yet through HARegionQueue). This new update will update on server to be a staled data (lost some of the attributes).

      The stack shows the get and the following put of the session are:

              at org.apache.geode.internal.cache.LocalRegion.get(LocalRegion.java:1312)
              at org.apache.geode.internal.cache.AbstractRegion.get(AbstractRegion.java:436)
              at org.apache.geode.modules.session.catalina.AbstractSessionCache.getSession(AbstractSessionCache.java:69)
              at org.apache.geode.modules.session.catalina.DeltaSessionManager.findSession(DeltaSessionManager.java:340)
              at org.apache.catalina.connector.Request.doGetSession(Request.java:2951)
              at org.apache.catalina.connector.Request.getSessionInternal(Request.java:2677)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:460)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
              at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
              at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
              at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
              at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
              at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
              at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:748)
      

      and

              at org.apache.geode.internal.cache.LocalRegion.put(LocalRegion.java:1628)
              at org.apache.geode.modules.session.catalina.DeltaSession.putInRegion(DeltaSession.java:442)
              at org.apache.geode.modules.session.catalina.DeltaSession.commit(DeltaSession.java:469)
              at org.apache.geode.modules.session.catalina.DeltaSessionFacade.commit(DeltaSessionFacade.java:36)
              at org.apache.geode.modules.session.catalina.CommitSessionValve.invoke(CommitSessionValve.java:56)
              at org.apache.geode.modules.session.catalina.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:45)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
              at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
              at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
              at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
              at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
              at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
              at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              eshu Eric Shu
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: