[jboss-jira] [JBoss JIRA] (WFLY-8931) InfinispanSessionManager#getActiveSessions (active-sessions attribute in CLI) returns an incorrect count on a coordinator node in cluster

Paul Ferraro (JIRA) issues at jboss.org
Tue Jun 13 09:14:02 EDT 2017


     [ https://issues.jboss.org/browse/WFLY-8931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Ferraro moved JBEAP-11526 to WFLY-8931:
--------------------------------------------

              Project: WildFly  (was: JBoss Enterprise Application Platform)
                  Key: WFLY-8931  (was: JBEAP-11526)
             Workflow: GIT Pull Request workflow   (was: CDW with loose statuses v1)
          Component/s: Clustering
                           (was: Clustering)
    Affects Version/s: 11.0.0.Alpha1
                           (was: 7.1.0.ER1)


> InfinispanSessionManager#getActiveSessions (active-sessions attribute in CLI) returns an incorrect count on a coordinator node in cluster
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-8931
>                 URL: https://issues.jboss.org/browse/WFLY-8931
>             Project: WildFly
>          Issue Type: Bug
>          Components: Clustering
>    Affects Versions: 11.0.0.Alpha1
>            Reporter: Paul Ferraro
>            Assignee: Paul Ferraro
>
> 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.
> {code:java|title=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     }
> {code}
> {code:java|title=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     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list