Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-10372

ConcurrentModificationException occurs on TimedCachePolicy.getValidKeys() method

    XMLWordPrintable

Details

    • Release Notes
    • Not Yet Documented
    • NEW

    Description

      TimedCachePolicy.getValidKeys() method and TimedCachePolicy.get() method do not synchronize. If entryMap.remove(key) on line 269th is executed by other thread before processing of iter.next() on line 364th, the ConcurrentModificationException will occur in line 364th.

      258:   public Object get(Object key) 
      259:   {
      260:      TimedEntry entry = (TimedEntry) entryMap.get(key);
      261:      if( entry == null )
      262:         return null;
      263:
      264:      if( entry.isCurrent(now) == false )
      265:      {   // Try to refresh the entry
      266:         if( entry.refresh() == false )
      267:         {   // Failed, remove the entry and return null
      268:            entry.destroy();
      269:            entryMap.remove(key);
      270:            return null;
      271:         }
      272:      }
      273:      Object value = entry.getValue();
      274:      return value;
      275:   }
      
      356:   public List getValidKeys()
      357:   {
      358:      ArrayList validKeys = new ArrayList();
      359:      synchronized( entryMap )
      360:      {
      361:         Iterator iter = entryMap.entrySet().iterator();
      362:         while( iter.hasNext() )
      363:         {
      364:            Map.Entry entry = (Map.Entry) iter.next();
      365:            TimedEntry value = (TimedEntry) entry.getValue();
      366:            if( value.isCurrent(now) == true )
      367:               validKeys.add(entry.getKey());
      368:         }
      369:      }
      370:      return validKeys;
      371:   }
      

      In the case of seam application, if this issue occurs in processing of first time access, that application cannot be used any longer.

      2012-11-08 09:18:53,935 SEVERE [facelets.viewhandler] (http-127.0.0.1-8080-1) Error Rendering View[/home.xhtml]
      java.util.ConcurrentModificationException
      	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
      	at java.util.HashMap$EntryIterator.next(HashMap.java:834)
      	at java.util.HashMap$EntryIterator.next(HashMap.java:832)
      	at org.jboss.util.TimedCachePolicy.getValidKeys(TimedCachePolicy.java:364)
      	at org.jboss.virtual.plugins.cache.IterableTimedVFSCache.findContext(IterableTimedVFSCache.java:65)
      	at org.jboss.virtual.plugins.cache.CombinedVFSCache.findContext(CombinedVFSCache.java:116)
      	at org.jboss.virtual.plugins.registry.DefaultVFSRegistry.getContext(DefaultVFSRegistry.java:132)
      	at org.jboss.virtual.VFS.getVFS(VFS.java:203)
      	at org.jboss.virtual.VFS.createNewRoot(VFS.java:228)
      	at org.jboss.virtual.VFS.getRoot(VFS.java:244)
      	at org.jboss.virtual.VFS.getRoot(VFS.java:313)
      	at com.sun.facelets.util.VFSClasspath.search(VFSClasspath.java:48)
      	at com.sun.facelets.util.Classpath.search(Classpath.java:63)
      	at com.sun.facelets.compiler.TagLibraryConfig.loadImplicit(TagLibraryConfig.java:428)
      	at com.sun.facelets.compiler.Compiler.initialize(Compiler.java:87)
      	at com.sun.facelets.compiler.Compiler.compile(Compiler.java:104)
      --- snip ---
      2012-11-08 09:18:54,053 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (http-127.0.0.1-8080-1) [com.arjuna.ats.arjuna.coordinator.BasicAction_40] - Abort called on already aborted atomic action 7f000001:96cd:509af812:74
      2012-11-08 09:19:19,715 SEVERE [facelets.viewhandler] (http-127.0.0.1-8080-1) Error Rendering View[/home.xhtml]
      javax.el.ELException: /home.xhtml: Property 'login' not found on type org.jboss.seam.security.Identity
      		      at com.sun.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:53)
      		      at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
      		      at com.sun.facelets.compiler.UILeaf.encodeAll(UILeaf.java:149)
      		      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
      		      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      --- snip ---
      2012-11-08 09:19:23,182 SEVERE [facelets.viewhandler] (http-127.0.0.1-8080-1) Error Rendering View[/home.xhtml]
      javax.el.ELException: /home.xhtml: Property 'login' not found on type org.jboss.seam.security.Identity
      		      at com.sun.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:53)
      		      at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
      		      at com.sun.facelets.compiler.UILeaf.encodeAll(UILeaf.java:149)
      		      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
      		      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      --- snip ---2012-11-08 09:20:04,943 SEVERE [facelets.viewhandler] (http-127.0.0.1-8080-1) Error Rendering View[/home.xhtml]
      javax.el.ELException: /home.xhtml: Property 'login' not found on type org.jboss.seam.security.Identity
      ....
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rhn-support-enagai Eiichi Nagai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: