previousNodeId is set to nodeID and causes infinite loop in AggregatedLayoutManager.changeSiblingNodesOrder()

Description

After running load tests, 4 threads are still running with the following stack trace:

"TP-Processor2" daemon prio=1 tid=0x8d261448 nid=0x337c runnable [0x8b07b000..0x8b07c580]
at org.jasig.portal.layout.alm.AggregatedLayout.getLayoutNode(AggregatedLayout.java:108)
at org.jasig.portal.layout.alm.AggregatedLayoutManager.getLayoutNode(AggregatedLayoutManager.java:676)
at org.jasig.portal.layout.alm.AggregatedLayoutManager.changeSiblingNodesOrder(AggregatedLayoutManager.java:620)
at org.jasig.portal.layout.alm.AggregatedLayoutManager.moveWrongNodesToLostFolder(AggregatedLayoutManager.java:306)
at org.jasig.portal.layout.alm.AggregatedLayoutManager.moveWrongNodesToLostFolder(AggregatedLayoutManager.java:236)
at org.jasig.portal.layout.alm.AggregatedLayoutManager.loadUserLayout(AggregatedLayoutManager.java:848)
at org.jasig.portal.layout.alm.AggregatedLayoutManager.<init>(AggregatedLayoutManager.java:104)
at sun.reflect.GeneratedConstructorAccessor58.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.jasig.portal.layout.UserLayoutManagerFactory.getUserLayoutManager(UserLayoutManagerFactory.java:57)
at org.jasig.portal.UserPreferencesManager.<init>(UserPreferencesManager.java:212)
at org.jasig.portal.UserInstance.writeContent(UserInstance.java:145)
at org.jasig.portal.PortalSessionManager.doGet(PortalSessionManager.java:269)

================================

The layouts seem to be corrupt that causes the for loop in changeSiblingNodesOrder() at line 610 from returning.

The node "61" seems to have its previousNodeId set to itself!

Here is a printout from jdb:

layout.get("61") = {
firstChildNodeId: "16-45"
org.jasig.portal.layout.alm.ALNode.parentNodeId: "userLayoutRootNode"
org.jasig.portal.layout.alm.ALNode.nextNodeId: null
org.jasig.portal.layout.alm.ALNode.previousNodeId: "61"
org.jasig.portal.layout.alm.ALNode.nodeDescription: instance of org.jasig.portal.layout.alm.ALFolderDescription(id=4881)
org.jasig.portal.layout.alm.ALNode.priority: 200
}

-----------------------
I think I'm going to need to add sanity checks to try and throw an exception when the previousNodeId is set to the same as the node's id.

Environment

None

Activity

Show:
Brad Johnson
August 5, 2005, 11:38 PM

This is fixed by simple sanity checks. If the layout is corrupt where it points to itself then the code will throw an exception instead of looping forever.

Andrew Petro
August 20, 2007, 10:20 PM

Re-opening to update affects-version metadata to reflect that this issue afflicts 2.4.x

Andrew Petro
August 20, 2007, 10:40 PM

Patch to apply this corruption detection code to 2.4.2

Andrew Petro
August 20, 2007, 11:24 PM

This issue now also addressed in 2-4-patches and in the 2.4.2 ALM exploratory branch.

Fixed

Assignee

Brad Johnson

Reporter

Brad Johnson

Labels

None

Estimated End Date

None

Components

Fix versions

Priority

Major