Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-4697

SubscriptionRegistry.subscribe can cause thread to freeze

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.1.2.GA
    • Fix Version/s: 2.2.1.CR3
    • Component/s: Remoting
    • Labels:
      None
    • Environment:

      ubuntu hardy, j2se 64-bit build 1.6.0_17-b04, jboss 4.2.3

    • Workaround:
      Workaround Exists

      Description

      We ran into an issue where we got really high cpu usage on one instance of our application. Upon inspection in yourkit profiler, we found that the following threads we're consuming all the cpu(see stacktraces below).

      Upon googling, we saw several posts where concurrent access to hashmap can cause it to enter into an infinite loop.
      http://lightbody.net/blog/2005/07/hashmapget_can_cause_an_infini.html

      Subscription registry is using a HashMap and HashSet(for user tokens) below the covers, so I think this issue can be fixed by just using ConcurrentHashMap and ConcurrentHashSet respectively.

      Thread: ajp-172.17.8.20-8209-2 : priority:5, demon:true, threadId:228, threadState:RUNNABLE, lockName:null

      java.util.HashMap.put(HashMap.java:405)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

      Thread: ajp-172.17.8.20-8209-6 : priority:5, demon:true, threadId:279, threadState:RUNNABLE, lockName:null

      java.util.HashMap.put(HashMap.java:405)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)

      Thread: ajp-172.17.8.20-8209-10 : priority:5, demon:true, threadId:5336, threadState:RUNNABLE, lockName:null

      java.util.HashMap.put(HashMap.java:405)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

      Thread: ajp-172.17.8.20-8209-18 : priority:5, demon:true, threadId:10515, threadState:RUNNABLE, lockName:null

      java.util.HashMap.transfer(HashMap.java:527)
      java.util.HashMap.resize(HashMap.java:506)
      java.util.HashMap.addEntry(HashMap.java:810)
      java.util.HashMap.put(HashMap.java:416)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

      Thread: ajp-172.17.8.20-8209-21 : priority:5, demon:true, threadId:10518, threadState:RUNNABLE, lockName:null

      java.util.HashMap.put(HashMap.java:405)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

      Thread: ajp-172.17.8.20-8209-26 : priority:5, demon:true, threadId:10523, threadState:RUNNABLE, lockName:null

      java.util.HashMap.put(HashMap.java:405)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)

      Thread: ajp-172.17.8.20-8209-29 : priority:5, demon:true, threadId:16450, threadState:RUNNABLE, lockName:null

      java.util.HashMap.put(HashMap.java:405)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      Thread: ajp-172.17.8.20-8209-35 : priority:5, demon:true, threadId:26542, threadState:RUNNABLE, lockName:null

      java.util.HashMap.put(HashMap.java:405)
      org.jboss.seam.remoting.messaging.SubscriptionRegistry.subscribe(SubscriptionRegistry.java:121)
      org.jboss.seam.remoting.messaging.SubscriptionRequest.subscribe(SubscriptionRequest.java:22)
      org.jboss.seam.remoting.SubscriptionHandler.handle(SubscriptionHandler.java:68)
      org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
      org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shane.bryzak Shane Bryzak
                Reporter:
                mark_v_torres Mark Torres
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: