4 Replies Latest reply on Apr 19, 2010 2:24 PM by Nick Belaevski

    Problem with HashMap causing 100% load?

    Sebastian Hundt Newbie

      We are using RichFaces in our application and encountered an issue which from our point of view is caused in the ajax4jsf-Framework.

      Objects of type HashMap are not threadsafe. If you are using put() and get() parallely in different threads those methods will run and run and run .. and never stop.
      Monitoring then shows the CPU load at 100%.

      We've got a stacktrace for this issue:
      Is this maybe an "instance" of the problem i described above? If yes, will there be a patch?

      http-www...-8080-67" daemon prio=10 tid=0x00007fde246de000 nid=0x3d57 runnable [0x00007fde12941000]
       java.lang.Thread.State: RUNNABLE
       at java.util.HashMap.get(HashMap.java:303)
       at org.ajax4jsf.component.UIDataAdaptor.getChildState(UIDataAdaptor.java:873)
       at org.ajax4jsf.component.UIDataAdaptor.saveChildState(UIDataAdaptor.java:890)
       at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:345)
       at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:324)
       at org.ajax4jsf.renderkit.html.RepeatRenderer$1.process(RepeatRenderer.java:48)
       at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:101)
       at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1133)
       at org.ajax4jsf.renderkit.html.RepeatRenderer.encodeChildren(RepeatRenderer.java:59)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
       at org.ajax4jsf.renderkit.html.RepeatRenderer$1.process(RepeatRenderer.java:53)
       at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:101)
       at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1133)
       at org.ajax4jsf.renderkit.html.RepeatRenderer.encodeChildren(RepeatRenderer.java:59)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
       at org.ajax4jsf.renderkit.html.RepeatRenderer$1.process(RepeatRenderer.java:53)
       at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:101)
       at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1133)
       at org.ajax4jsf.renderkit.html.RepeatRenderer.encodeChildren(RepeatRenderer.java:59)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
       at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:78)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
       at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:78)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:166)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:157)
       at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
       at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:677)
       at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:548)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
       at org.restfaces.application.RestViewHandler.renderView(RestViewHandler.java:148)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)


        • 1. Re: Problem with HashMap causing 100% load?
          Ilya Shaikovsky Master

          the problem could be also in your model code used. Need more information.

          • 2. Re: Problem with HashMap causing 100% load?
            sun meng Newbie

            Hi:
            I had similar problems.By 'top' command I find that cpu usage of java pesists to be 400% in server.

             

            [root]# top -H -p 1234
            7m  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                  
            19608 root      25   0 1242m 914m 9496 R   99 45.4 575:22.02 java                                                                         
            3379 root      25   0 1242m 914m 9496 R   97 45.4 586:36.32 java                                                                         
            3902 root      25   0 1242m 914m 9496 R   95 45.4 585:59.96 java                                                                         
            3901 root      25   0 1242m 914m 9496 R   91 45.4 586:28.10 java

             

            The Linux thread ID's and the Java thread dump shows me that the threads spinning out of control are:

             

            "http-0.0.0.0-8080-13" daemon prio=10 tid=0xbaebb000 nid=0x4c98 runnable [0xb0a5b000]
               java.lang.Thread.State: RUNNABLE
            at java.util.HashMap.get(HashMap.java:303)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.getEncInjectionsForClass(TomcatInjectionContainer.java:443)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.getEncInjectionsForObject(TomcatInjectionContainer.java:435)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.processInjectors(TomcatInjectionContainer.java:355)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:271)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:265)
            at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
            - locked <0xe1a83600> (a org.apache.jasper.servlet.JspServletWrapper)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
              ...


            "http-0.0.0.0-8080-5" daemon prio=10 tid=0x085bc400 nid=0xd33 runnable [0xb7742000]
               java.lang.Thread.State: RUNNABLE
            at java.util.HashMap.get(HashMap.java:303)
            at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:71)
            at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:92)
            at org.jboss.web.tomcat.service.injection.TomcatInjectionUtils.processDynamicBeanAnnotations(TomcatInjectionUtils.java:59)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.processAnnotations(TomcatInjectionContainer.java:407)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.processDynamicBeanAnnotations(TomcatInjectionContainer.java:382)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:274)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:265)
            at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
            ...


            "http-0.0.0.0-8080-10" daemon prio=10 tid=0xb9e25c00 nid=0xf3e runnable [0xb716e000]
               java.lang.Thread.State: RUNNABLE
            at java.util.HashMap.get(HashMap.java:303)
            at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:71)
            at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:92)
            at org.jboss.web.tomcat.service.injection.TomcatInjectionUtils.processDynamicBeanAnnotations(TomcatInjectionUtils.java:59)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.processAnnotations(TomcatInjectionContainer.java:407)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.processDynamicBeanAnnotations(TomcatInjectionContainer.java:382)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:274)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:265)
            at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
            - locked <0xe1711200> (a org.apache.jasper.servlet.JspServletWrapper)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            ...


            "http-0.0.0.0-8080-9" daemon prio=10 tid=0xb9e25400 nid=0xf3d runnable [0xb71bf000]
               java.lang.Thread.State: RUNNABLE
            at java.util.HashMap.get(HashMap.java:303)
            at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:71)
            at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:92)
            at org.jboss.web.tomcat.service.injection.TomcatInjectionUtils.processDynamicBeanAnnotations(TomcatInjectionUtils.java:59)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.processAnnotations(TomcatInjectionContainer.java:407)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.processDynamicBeanAnnotations(TomcatInjectionContainer.java:382)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:274)
            at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:265)
            at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
            - locked <0xe16678b0> (a org.apache.jasper.servlet.JspServletWrapper)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            ...

            I'm not sure that the code of jboss has encountered problemby  not my application bugs, but don't know the real reason.

            Any idea, Thanks in advance.

            • 4. Re: Problem with HashMap causing 100% load?
              Nick Belaevski Master

              at java.util.HashMap.get(HashMap.java:303)
              at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:71)
              at org.jboss.injection.InjectionUtil.collapseXmlMethodInjectors(InjectionUtil.java:92)
              at org.jboss.web.tomcat.service.injection.TomcatInjectionUtils.processDynamicBeanAnnotations(TomcatInjectionUtils.java:59)

              Looks like a problem in EJB3 module of JBoss AS, not inside RF. Have you asked at AS forum?