Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid infinite loop when cycle in hierarchy #1

Open
wants to merge 1 commit into
base: 1.2.12.7.0-branch
Choose a base branch
from
Open

Avoid infinite loop when cycle in hierarchy #1

wants to merge 1 commit into from

Conversation

orlat84
Copy link

@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
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
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants