Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-11499

[GSS](7.0.z) InfinispanSessionManager#getActiveSessions (active-sessions attribute in CLI) returns an incorrect count on a coordinator node in cluster

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • None
    • 7.0.1.GA, 7.0.2.GA, 7.0.3.GA, 7.0.4.GA, 7.0.5.GA, 7.0.6.CR1
    • Clustering
    • None
    • Hide
      1. Start two EAP 7 instances with standalone-ha.xml
        • First, start node1 to make sure that node1 becomes a coordinator node
        • Then start node2
      2. Deploy a web application which has <distributable/> in web.xml to enable session replication
      3. Access the web app only on node1 (coordinator node) several times. For example, 3 times.
      4. Check the number of active session count on both nodes:
        /deployment=${deployment-name}/subsystem=undertow:read-attribute(name=active-sessions)
        

        In this exampe scenario, node1 returns 3 and node2 returns 0. As node2 is not accessed, both values are correct at this moment.

      5. Access the application only on node2 several times. For example, 3 times.
      6. Check the number of active session count on both nodes:
        /deployment=${deployment-name}/subsystem=undertow:read-attribute(name=active-sessions)
        

        In this exampe scenario, node1 returns 6 and node2 returns 3. node2 returns the correct count but node1 returns the incorrect count. It should return 3.

      Show
      Start two EAP 7 instances with standalone-ha.xml First, start node1 to make sure that node1 becomes a coordinator node Then start node2 Deploy a web application which has <distributable/> in web.xml to enable session replication Access the web app only on node1 (coordinator node) several times. For example, 3 times. Check the number of active session count on both nodes: /deployment=${deployment-name}/subsystem=undertow:read-attribute(name=active-sessions) In this exampe scenario, node1 returns 3 and node2 returns 0. As node2 is not accessed, both values are correct at this moment. Access the application only on node2 several times. For example, 3 times. Check the number of active session count on both nodes: /deployment=${deployment-name}/subsystem=undertow:read-attribute(name=active-sessions) In this exampe scenario, node1 returns 6 and node2 returns 3. node2 returns the correct count but node1 returns the incorrect count. It should return 3.

    Description

      Since EAP 7.0.1 coming with the fix for JBEAP-4646 (upstream WFLY-6453), InfinispanSessionManager#getActiveSessions (active-sessions attribute on CLI) was changed to return active session count with current node locality.

      However, it returns an incorrect count on a cluster coordinator node. For example, when two node cluster is configured, it returns total count of active sessions. This happens regardless of using "dist" cache or using "repl" cache.

      The followings are the related code. It appears ConsistentHashLocality#isLocal(key) always returns true on a coordinator node and it causes incorrect active session count.

      clustering/web/infinispan/src/main/java/org/wildfly/clustering/web/infinispan/session/InfinispanSessionManager.java
      268     @Override
      269     public Set<String> getActiveSessions() {
      270         // Omit remote sessions (i.e. when using DIST mode) as well as passivated sessions
      271         return this.getSessions(Flag.CACHE_MODE_LOCAL, Flag.SKIP_CACHE_LOAD);
      272     }
       :
      280     private Set<String> getSessions(Flag... flags) {
      281         try (Stream<? extends Key<String>> keys = this.cache.getAdvancedCache().withFlags(flags).keySet().stream()) {
      282             return keys.filter(this.filter.and(key -> this.locality.isLocal(key))).map(key -> key.getValue()).collect(Collectors.toSet());
      283         }
      284     }
      
      clustering/infinispan/spi/src/main/java/org/wildfly/clustering/infinispan/spi/distribution/ConsistentHashLocality.java
       51     @Override
       52     public boolean isLocal(Object key) {
       53         if (this.localAddress == null) return true;
       54         if (this.hash == null) return true;
       55         return this.localAddress.equals(this.hash.locatePrimaryOwner(key));
       56     }
      

      Attachments

        Issue Links

          Activity

            People

              pferraro@redhat.com Paul Ferraro
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: