Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Avoid infinite loop when cycle in hierarchy#1

Open
orlat84 wants to merge 1 commit into
apache:1.2.12.7.0-branchfrom
orlat84:patch-1
Open

Avoid infinite loop when cycle in hierarchy#1
orlat84 wants to merge 1 commit into
apache:1.2.12.7.0-branchfrom
orlat84:patch-1

Conversation

@orlat84
Copy link
Copy Markdown

@orlat84 orlat84 commented Apr 13, 2019

In certain cases, cycles in the components hierarchy appear. Due to the current implementation an infinite loop is generated and the thread hogs the CPU. The only option is to kill the JVM.
The proposed change avoids this situation.

In certain cases, cycles in the components hierarchy appear. Due to the current implementation an infinite loop is generated and the thread hogs the CPU. The only option is to kill the JVM.
The proposed change avoids this situation.
@orlat84 orlat84 closed this Apr 13, 2019
@orlat84 orlat84 reopened this Apr 13, 2019
@deki
Copy link
Copy Markdown
Contributor

deki commented Apr 14, 2019

Thanks for the PR. Please change it to point to the master branch.

Do you have a test case to reproduce the issue? I'm asking because we don't have active trinidad developers currently and this would make it easier to review.

@orlat84
Copy link
Copy Markdown
Author

orlat84 commented Apr 14, 2019

Had a look in the master branch and the code seems a lot changed between these versions.
I am not sure where this fix should be inserted in the newer versions.

Regarding the test case I have a dummy one as I did not manage yet to catch the one from the customer environment, given the high degree of customizations they have.

Let's say we have a page like this:
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/rich" prefix="af"%>
<f:view>
<af:document id="d1" title="Infinite loop on click">
<af:form id="f1">
<af:commandButton text="Loop" id="cb1" action="#{TestBean.push}"/>
</af:form>
</af:document>
</f:view>

and the button bean looks like this:

`package net.orlat84;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

public class InfiniteLoopBean {

public String push() {
    UIComponent d1 = FacesContext.getCurrentInstance().getViewRoot().findComponent("d1");
    UIComponent f1 = FacesContext.getCurrentInstance().getViewRoot().findComponent("f1");
    d1.setParent(f1);
    return null;
}

}
`
When the button is pressed an infinite loop is generated in the VM and the only way to get rid of it is to bounce the whole server.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants