StackOverflowError on WebClient.getPage
See original GitHub issueURL: https://sustainability.asu.edu/person/angela-gonzales version: 2.39.1 VM arguments: -Xmx4096m
The following code throws java.lang.StackOverflowError after more than 10 minutes .
`
WebClient client = null;
try
{
client = new WebClient();
client.getOptions().setCssEnabled(false);
client.getOptions().setJavaScriptEnabled(false);
client.getOptions().setTimeout(20000);
Page page = client.getPage("https://sustainability.asu.edu/person/angela-gonzales");
if (page != null && page.isHtmlPage())
{
HtmlPage htmlPage = (HtmlPage) page;
System.out.println("html page downloaded");
System.out.println(htmlPage.asText());
}
}
catch (Throwable e)
{
e.printStackTrace();
}
finally
{
if (client != null)
{
client.close();
}
}
`
`
java.lang.StackOverflowError at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) … at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) at com.gargoylesoftware.htmlunit.html.FrameWindow.getTopWindow(FrameWindow.java:77) at com.gargoylesoftware.htmlunit.html.HtmlPage.getBaseURL(HtmlPage.java:2316) at com.gargoylesoftware.htmlunit.html.HtmlPage.getFullyQualifiedUrl(HtmlPage.java:699) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPageIfPossible(BaseFrameElement.java:182) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPage(BaseFrameElement.java:124) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadFrames(HtmlPage.java:1919) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:251) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:561) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:420) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:337) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPageIfPossible(BaseFrameElement.java:198) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPage(BaseFrameElement.java:124) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadFrames(HtmlPage.java:1919) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:251) … at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:561) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:420) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:337) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPageIfPossible(BaseFrameElement.java:198) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPage(BaseFrameElement.java:124) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadFrames(HtmlPage.java:1919) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:251) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:561) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:420) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:337) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPageIfPossible(BaseFrameElement.java:198) at com.gargoylesoftware.htmlunit.html.BaseFrameElement.loadInnerPage(BaseFrameElement.java:124) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadFrames(HtmlPage.java:1919) `
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
Ok, regarding the reason - you have disabled js and the page contains a noscript tag that contains a iframe like this
In fact this results in a call to the same url as the page itself but with a different query string. And this returns the page including a noscript tag… and so on.
BTW this looks like one of the spy snippets like to be informed about the peoples not having js enabled also.
The trick in this case is the response for the iframe includes an X-Frame-Options: DENY header and this was ignored by HtmlUnit so far.
Have done some implementation and test for this. At the moment the ci build is running and if there are ne new errors i will make a new snapshot available soon (check twitter).
Yes another funny case. Have written some test and will try to fix it.