[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-4021) ArrayIndexOutOfBoundsException in SessionContext.getNames() when concurrent access from same user

Pete Muir (JIRA) jira-events at lists.jboss.org
Thu Apr 16 07:10:40 EDT 2009


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

Pete Muir updated JBSEAM-4021:
------------------------------

    Fix Version/s: 2.1.2.GA


> ArrayIndexOutOfBoundsException in SessionContext.getNames() when concurrent access from same user
> -------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-4021
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4021
>             Project: Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.1.GA
>            Reporter: Takayoshi Kimura
>            Assignee: Norman Richards
>             Fix For: 2.1.2.GA
>
>         Attachments: patch.txt, Test.java
>
>
> ArrayIndexOutOfBoundsException in SessionContext.getNames() when concurrent access from same user
> The SessionContext.getNames() calls super.getNames() and the BasicContext.getNames() does the following:
>    public String[] getNames()
>    {
>       //yes, I know about the toArray() method,
>       //but there is a bug in the RI!
>       Set<String> keySet = map.keySet();
>       String[] array = new String[ keySet.size() ];
>       int i=0;
>       for (String key: keySet)
>       {
>          array[i++] = key;
>       }
>       return array;
>    }
> An ArrayIndexOutOfBoundsException (and possibly a ConcurrentModificationException) could be thrown when an entry is added to the session map during iteration, after the keySet.size() call.
> The FacesLifecycle uses the ExternalContext.getSessionMap() for SessionContext internal data. This map is directly tied with HttpSession and it reflects changes on the HttpSession from other threads immediately.
> This problem doesn't happen with ServletLifecycle because it uses ServletRequestMap class for internal data and this class always creates new instance per keySet() call. The keySet from this map won't be changed during iteration.
> This problem happends regardless of debug mode.
> 2009-02-17 16:10:05,699 ERROR [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception
> java.lang.ArrayIndexOutOfBoundsException: 35
>        at org.jboss.seam.contexts.BasicContext.getNames(BasicContext.java:60)
>        at org.jboss.seam.contexts.SessionContext.getNames(SessionContext.java:34)
>        at org.jboss.seam.contexts.SessionContext.flush(SessionContext.java:47)
>        at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:385)
>        at org.jboss.seam.contexts.FacesLifecycle.endRequest(FacesLifecycle.java:112)
>        at org.jboss.seam.jsf.SeamPhaseListener.afterResponseComplete(SeamPhaseListener.java:524)
>        at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:249)
>        at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
>        at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
>        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
>        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
>        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
>        at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
>        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
>        at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
>        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
>        at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
>        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
>        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
>        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
>        at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
>        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
>        at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
>        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
>        at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
>        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
>        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
>        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
>        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
>        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
>        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:543)
>        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
>        at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
>        at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
>        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>        at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list