You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Woonsan Ko (JIRA)" <je...@portals.apache.org> on 2006/12/04 13:27:23 UTC

[jira] Created: (JS2-619) Non-thread safe code in PortalSiteRequestContextImpl.java

Non-thread safe code in PortalSiteRequestContextImpl.java
---------------------------------------------------------

                 Key: JS2-619
                 URL: http://issues.apache.org/jira/browse/JS2-619
             Project: Jetspeed 2
          Issue Type: Bug
          Components: Components Core
    Affects Versions: 2.1-dev
         Environment: Any environment.
            Reporter: Woonsan Ko
            Priority: Minor


Every header.vm calls $site.getMenu(...) to retreive menus for a folder.
And the class, named 'org.apache.jetspeed.portalsite.impl.PortalSiteRequestContextImpl', manages a set and a map to store and query portlet definition names and menus.

However, because those are instantiated as a HashSet and as a HashMap, JS2 can throw ConcurrentModificationException when portlet definitions and menus are to be cached.

This exception can be observed in the following case:
  - For some reason, user can request twice for the same folder.
  - For some reason, a developer can design the pages to call header.vm simultaneously.
(Actually these situations are not usual and it may not occur after first visit for a folder, but it can occur.)

Therefore, those are to be synchronized.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


[jira] Updated: (JS2-619) Non-thread safe code in PortalSiteRequestContextImpl.java

Posted by "Woonsan Ko (JIRA)" <je...@portals.apache.org>.
     [ http://issues.apache.org/jira/browse/JS2-619?page=all ]

Woonsan Ko updated JS2-619:
---------------------------

    Attachment: getmenu-diff.txt

My fixes for this issue.

> Non-thread safe code in PortalSiteRequestContextImpl.java
> ---------------------------------------------------------
>
>                 Key: JS2-619
>                 URL: http://issues.apache.org/jira/browse/JS2-619
>             Project: Jetspeed 2
>          Issue Type: Bug
>          Components: Components Core
>    Affects Versions: 2.1-dev
>         Environment: Any environment.
>            Reporter: Woonsan Ko
>            Priority: Minor
>         Attachments: getmenu-diff.txt
>
>
> Every header.vm calls $site.getMenu(...) to retreive menus for a folder.
> And the class, named 'org.apache.jetspeed.portalsite.impl.PortalSiteRequestContextImpl', manages a set and a map to store and query portlet definition names and menus.
> However, because those are instantiated as a HashSet and as a HashMap, JS2 can throw ConcurrentModificationException when portlet definitions and menus are to be cached.
> This exception can be observed in the following case:
>   - For some reason, user can request twice for the same folder.
>   - For some reason, a developer can design the pages to call header.vm simultaneously.
> (Actually these situations are not usual and it may not occur after first visit for a folder, but it can occur.)
> Therefore, those are to be synchronized.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


[jira] Assigned: (JS2-619) Non-thread safe code in PortalSiteRequestContextImpl.java

Posted by "David Sean Taylor (JIRA)" <je...@portals.apache.org>.
     [ http://issues.apache.org/jira/browse/JS2-619?page=all ]

David Sean Taylor reassigned JS2-619:
-------------------------------------

    Assignee: David Sean Taylor

> Non-thread safe code in PortalSiteRequestContextImpl.java
> ---------------------------------------------------------
>
>                 Key: JS2-619
>                 URL: http://issues.apache.org/jira/browse/JS2-619
>             Project: Jetspeed 2
>          Issue Type: Bug
>          Components: Components Core
>    Affects Versions: 2.1-dev
>         Environment: Any environment.
>            Reporter: Woonsan Ko
>         Assigned To: David Sean Taylor
>            Priority: Minor
>         Attachments: getmenu-diff.txt, getmenu-diff2.txt
>
>
> Every header.vm calls $site.getMenu(...) to retreive menus for a folder.
> And the class, named 'org.apache.jetspeed.portalsite.impl.PortalSiteRequestContextImpl', manages a set and a map to store and query portlet definition names and menus.
> However, because those are instantiated as a HashSet and as a HashMap, JS2 can throw ConcurrentModificationException when portlet definitions and menus are to be cached.
> This exception can be observed in the following case:
>   - For some reason, user can request twice for the same folder.
>   - For some reason, a developer can design the pages to call header.vm simultaneously.
> (Actually these situations are not usual and it may not occur after first visit for a folder, but it can occur.)
> Therefore, those are to be synchronized.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


[jira] Resolved: (JS2-619) Non-thread safe code in PortalSiteRequestContextImpl.java

Posted by "David Sean Taylor (JIRA)" <je...@portals.apache.org>.
     [ http://issues.apache.org/jira/browse/JS2-619?page=all ]

David Sean Taylor resolved JS2-619.
-----------------------------------

    Resolution: Fixed

patch applied

> Non-thread safe code in PortalSiteRequestContextImpl.java
> ---------------------------------------------------------
>
>                 Key: JS2-619
>                 URL: http://issues.apache.org/jira/browse/JS2-619
>             Project: Jetspeed 2
>          Issue Type: Bug
>          Components: Components Core
>    Affects Versions: 2.1-dev
>         Environment: Any environment.
>            Reporter: Woonsan Ko
>         Assigned To: David Sean Taylor
>            Priority: Minor
>         Attachments: getmenu-diff.txt, getmenu-diff2.txt
>
>
> Every header.vm calls $site.getMenu(...) to retreive menus for a folder.
> And the class, named 'org.apache.jetspeed.portalsite.impl.PortalSiteRequestContextImpl', manages a set and a map to store and query portlet definition names and menus.
> However, because those are instantiated as a HashSet and as a HashMap, JS2 can throw ConcurrentModificationException when portlet definitions and menus are to be cached.
> This exception can be observed in the following case:
>   - For some reason, user can request twice for the same folder.
>   - For some reason, a developer can design the pages to call header.vm simultaneously.
> (Actually these situations are not usual and it may not occur after first visit for a folder, but it can occur.)
> Therefore, those are to be synchronized.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


[jira] Updated: (JS2-619) Non-thread safe code in PortalSiteRequestContextImpl.java

Posted by "Woonsan Ko (JIRA)" <je...@portals.apache.org>.
     [ http://issues.apache.org/jira/browse/JS2-619?page=all ]

Woonsan Ko updated JS2-619:
---------------------------

    Attachment: getmenu-diff2.txt

I modified another source named 'NodeProxy' because it creates ArrayList instances which may be shared among threads.

This attachement includes my previous changes.

I modified 'NodeProxy' as follows:
  - The lists for menu definition locators and menu definitions should be synchronized lists.
  - Because iterations need to be manually synchronized (See javadoc on java.util.Collections.synchronizedList() method.), 'synchronized' was added in the 'findMenuDefinitionLocator()' method of 'NodeProxy' class.

FYI, if concurrent requests are sent by same session, then 
a user can meet 'Content not available' in screen and the following exceptions can be logged:

java.util.ConcurrentModificationException
	at java.util.AbstractList$Itr.checkForComodification(AbstractList.java(Inlined Compiled Code))
	at java.util.AbstractList$Itr.next(AbstractList.java(Compiled Code))
	at org.apache.jetspeed.page.document.proxy.NodeProxy.findMenuDefinitionLocator(NodeProxy.java:333)
	at org.apache.jetspeed.page.document.proxy.NodeProxy.menuDefinitionLocatorsContains(NodeProxy.java:316)
	at org.apache.jetspeed.page.document.proxy.NodeProxy.mergeMenuDefinitionLocators(NodeProxy.java:295)
	at org.apache.jetspeed.om.page.proxy.PageProxy.aggregateMenuDefinitionLocators(PageProxy.java:156)
	at org.apache.jetspeed.page.document.proxy.NodeProxy.getMenuDefinitionLocators(NodeProxy.java:204)
	at org.apache.jetspeed.page.document.proxy.NodeProxy.getMenuDefinitionLocator(NodeProxy.java:219)
	at org.apache.jetspeed.portalsite.view.SiteView.getMenuDefinitionLocator(SiteView.java:1198)
	at org.apache.jetspeed.portalsite.impl.PortalSiteSessionContextImpl.getMenuDefinitionLocator(PortalSiteSessionContextImpl.java:926)
	at org.apache.jetspeed.portalsite.impl.PortalSiteRequestContextImpl.getMenu(PortalSiteRequestContextImpl.java:473)
	at org.apache.jetspeed.portalsite.impl.PortalSiteRequestContextImpl.getMenu(PortalSiteRequestContextImpl.java:450)

> Non-thread safe code in PortalSiteRequestContextImpl.java
> ---------------------------------------------------------
>
>                 Key: JS2-619
>                 URL: http://issues.apache.org/jira/browse/JS2-619
>             Project: Jetspeed 2
>          Issue Type: Bug
>          Components: Components Core
>    Affects Versions: 2.1-dev
>         Environment: Any environment.
>            Reporter: Woonsan Ko
>            Priority: Minor
>         Attachments: getmenu-diff.txt, getmenu-diff2.txt
>
>
> Every header.vm calls $site.getMenu(...) to retreive menus for a folder.
> And the class, named 'org.apache.jetspeed.portalsite.impl.PortalSiteRequestContextImpl', manages a set and a map to store and query portlet definition names and menus.
> However, because those are instantiated as a HashSet and as a HashMap, JS2 can throw ConcurrentModificationException when portlet definitions and menus are to be cached.
> This exception can be observed in the following case:
>   - For some reason, user can request twice for the same folder.
>   - For some reason, a developer can design the pages to call header.vm simultaneously.
> (Actually these situations are not usual and it may not occur after first visit for a folder, but it can occur.)
> Therefore, those are to be synchronized.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org