[jboss-jira] [JBoss JIRA] (WFLY-5331) ConcurrentModificationException in InfinispanSessionManager.findListeners
Petr Sígl (JIRA)
issues at jboss.org
Mon Sep 14 05:26:00 EDT 2015
Petr Sígl created WFLY-5331:
-------------------------------
Summary: ConcurrentModificationException in InfinispanSessionManager.findListeners
Key: WFLY-5331
URL: https://issues.jboss.org/browse/WFLY-5331
Project: WildFly
Issue Type: Bug
Components: Clustering
Affects Versions: 9.0.1.Final
Reporter: Petr Sígl
Assignee: Paul Ferraro
Priority: Critical
Configuration - standalone-ha.xml:
{noformat}
<cache-container name="web" default-cache="repl" module="org.wildfly.clustering.web.infinispan">
<transport lock-timeout="60000"/>
<replicated-cache name="repl" mode="ASYNC">
<locking isolation="READ_COMMITTED"/>
<transaction locking="OPTIMISTIC"/>
<file-store/>
</replicated-cache>
</cache-container>
{noformat}
After user is logged out, we invalidate session and show login page. Problem is, that sometimes server crashed with ConcurrentModificationException.
{noformat}
2015-09-10 08:55:24,571 ERROR [io.undertow.request] (default task-10) UT005023: Exception handling request to /blabla/login: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429)
at java.util.HashMap$KeyIterator.next(HashMap.java:1453)
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findListeners(InfinispanSessionManager.java:400)
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.triggerPostActivationEvents(InfinispanSessionManager.java:387)
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findSession(InfinispanSessionManager.java:245)
at org.wildfly.clustering.web.undertow.session.DistributableSessionManager.getSession(DistributableSessionManager.java:115)
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:723)
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:753)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:64)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2015-09-10 08:55:24,574 ERROR [cz.blabla.portal.error.ErrorHelper] (default task-10) HTTP error code 500 -> redirecting to default ERROR PAGE. Cause: null: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429)
at java.util.HashMap$KeyIterator.next(HashMap.java:1453)
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findListeners(InfinispanSessionManager.java:400)
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.triggerPostActivationEvents(InfinispanSessionManager.java:387)
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findSession(InfinispanSessionManager.java:245)
at org.wildfly.clustering.web.undertow.session.DistributableSessionManager.getSession(DistributableSessionManager.java:115)
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:723)
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:753)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:64)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
{noformat}
I think, that problem is in method InfinispanSessionManager.findListeners.
We have fix it with not very nice try - catch, maybe better way is to copy collection of names and iterate over it... I know it is not very nice and to be honest, I don't know if it is "right", but better then error page after logout :-).
{noformat}
private static List<HttpSessionActivationListener> findListeners(ImmutableSession session) {
List<HttpSessionActivationListener> listeners = new ArrayList<>();
try {
ImmutableSessionAttributes attributes = session.getAttributes();
Set<String> names = attributes.getAttributeNames();
if (names != null && !names.isEmpty()) {
for (String name: names) {
Object attribute = attributes.getAttribute(name);
if (attribute instanceof HttpSessionActivationListener) {
listeners.add((HttpSessionActivationListener) attribute);
}
}
}
} catch (Exception e) {
InfinispanWebLogger.ROOT_LOGGER.tracef("No session attributes found.", e);
}
return listeners;
}
{noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list