Jetspeed 2
  1. Jetspeed 2
  2. JS2-479

Non-thread safe code in the DB PageManager

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1-dev
    • Fix Version/s: 2.1-dev, 2.1
    • Component/s: PSML
    • Labels:
      None

      Description

      There are many places in the DB PageManager om implementation classes that are not thread safe, specifically in the transient data members used to wrap collections to work around OJB removal aware collection issues.

      All of the DB PageManager component code needs to be tightened to address these potential issues.

        Activity

        Hide
        Thorsten Berger added a comment -

        Hi Randy,

        I'm currently facing some problems with the non thread safety of the PageManager. My portal is creating a huge amount of folders and pages in one run with the PageManager API. The psmls are always created correctly, but the menu sometimes show the wrong values. They get sometimes not even refreshed by the FileCacheScanner, only restarting tomcat or rebuilding the folders and pages in another run helps.

        E.g. one excerpt from my code:

        pm.deepCopyFolder( navigationFolder, path, null );
        Folder newFolder = pm.getFolder( path );
        // set folder titles
        newFolder.setTitle( node.getName() );
        newFolder.setShortTitle( node.getName() );
        // folder menu definitions
        .....
        pm.updateFolder( newFolder );

        Sometimes the resulting folder still shows the old title (from the source folder) and not the subsequently set new title.

        I'm also seeing some ConcurrentModificationException in jetspeed.log:
        ...................
        2006-03-30 01:03:16,151 [Thread-3] DEBUG org.apache.jetspeed.portalsite.impl.PortalSiteSessionContextImpl - Page manager update event, (node=/courses/WS0506/folder.metadata): set session context state stale
        2006-03-30 01:03:16,151 [Thread-3] ERROR org.apache.jetspeed.cache.file.FileCache - FileCache Scanner: Error in iteration...
        java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
        at java.util.HashMap$ValueIterator.next(HashMap.java:817)
        at org.apache.jetspeed.cache.file.FileCache$FileCacheScanner.run(FileCache.java:401)
        2006-03-30 01:03:17,173 [Thread-3] DEBUG org.apache.jetspeed.page.document.psml.CastorFileSystemDocumentHandler - Entry is refreshing: folder.metadata
        ...................
        The ConcurrentModificationException could possibly be solved by using a cache Map with copy on write (COW) semantics as available in Java 1.5, but I still don't really overlook the implementation of the PageManager

        Randy, is there a solution in sight?

        Thanks in advance,
        Thorsten

        P.S. the PageManager does a good job, esp. the declarative menus

        Show
        Thorsten Berger added a comment - Hi Randy, I'm currently facing some problems with the non thread safety of the PageManager. My portal is creating a huge amount of folders and pages in one run with the PageManager API. The psmls are always created correctly, but the menu sometimes show the wrong values. They get sometimes not even refreshed by the FileCacheScanner, only restarting tomcat or rebuilding the folders and pages in another run helps. E.g. one excerpt from my code: pm.deepCopyFolder( navigationFolder, path, null ); Folder newFolder = pm.getFolder( path ); // set folder titles newFolder.setTitle( node.getName() ); newFolder.setShortTitle( node.getName() ); // folder menu definitions ..... pm.updateFolder( newFolder ); Sometimes the resulting folder still shows the old title (from the source folder) and not the subsequently set new title. I'm also seeing some ConcurrentModificationException in jetspeed.log: ................... 2006-03-30 01:03:16,151 [Thread-3] DEBUG org.apache.jetspeed.portalsite.impl.PortalSiteSessionContextImpl - Page manager update event, (node=/courses/WS0506/folder.metadata): set session context state stale 2006-03-30 01:03:16,151 [Thread-3] ERROR org.apache.jetspeed.cache.file.FileCache - FileCache Scanner: Error in iteration... java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787) at java.util.HashMap$ValueIterator.next(HashMap.java:817) at org.apache.jetspeed.cache.file.FileCache$FileCacheScanner.run(FileCache.java:401) 2006-03-30 01:03:17,173 [Thread-3] DEBUG org.apache.jetspeed.page.document.psml.CastorFileSystemDocumentHandler - Entry is refreshing: folder.metadata ................... The ConcurrentModificationException could possibly be solved by using a cache Map with copy on write (COW) semantics as available in Java 1.5, but I still don't really overlook the implementation of the PageManager Randy, is there a solution in sight? Thanks in advance, Thorsten P.S. the PageManager does a good job, esp. the declarative menus
        Hide
        Thorsten Berger added a comment -

        Oops, just noticed your commit yesterday ("fix multi-threading and session unloading bugs"). Does this solve this?

        Show
        Thorsten Berger added a comment - Oops, just noticed your commit yesterday ("fix multi-threading and session unloading bugs"). Does this solve this?
        Hide
        Randy Watler added a comment -

        Unfortunately, the recent patches will not help this newly found problem.

        Show
        Randy Watler added a comment - Unfortunately, the recent patches will not help this newly found problem.
        Hide
        Ate Douma added a comment -

        No problem reports anymore recently, considering it as fixed for now.

        Show
        Ate Douma added a comment - No problem reports anymore recently, considering it as fixed for now.

          People

          • Assignee:
            Randy Watler
            Reporter:
            Randy Watler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development