apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.36k stars 2.1k forks source link

HTML format the "Failed to Parse HTML : NULL" error message is displayed. #3996

Open asfimport opened 8 years ago

asfimport commented 8 years ago

Shivansh (Bug 59632): When trying to LOGIN into the application , the user is navigated to the Dashboard of the application ,but when trying to view the response in HTML format the "Failed to Parse HTML : NULL" error message is displayed.

Created attachment Jmeter Issue.png: Failed to Parse HTML : NULL error message is displayed.

Failed to Parse HTML : NULL error message is displayed.

Severity: major OS: All

asfimport commented 8 years ago

Sebb (migrated from Bugzilla): This is impossible to debug without further info.

Are there any related messages in the jmeter.log file?

What is the URL for the page?

asfimport commented 8 years ago

Shivansh (migrated from Bugzilla): I am Testing it on my Local server , so no such link is available for it.

asfimport commented 8 years ago

Shivansh (migrated from Bugzilla): In Jmeter Log file no such message is displayed.

asfimport commented 8 years ago

Shivansh (migrated from Bugzilla): Can i help you by providing some other details.

asfimport commented 8 years ago

Sebb (migrated from Bugzilla): (In reply to Shivansh from comment 4)

Can i help you by providing some other details.

Can you attach the HTML page for the URL that fails?

If that page contains sensitive information, feel free to redact it first, so long as the updated page still causes the issue.

asfimport commented 8 years ago

Shivansh (migrated from Bugzilla): Created attachment Text output on Error Page.txt: Text Output for Error Page

asfimport commented 8 years ago

Shivansh (migrated from Bugzilla): I have attached a Text File with containing the output in Text Format kindly check & Tell if it provides any help to u in understanding the source of problem.

asfimport commented 8 years ago

@FSchumacher (migrated from Bugzilla): The attached HTML Page has a few syntax errors. One is an unbalanced quote ("). That leads to an RuntimeException, that is thrown in javax.swing.text.html.CSSParser#readTill. That exception bubbles up the callstack and is caught by javax.swing.text.html.Parser#parse by the following construct: } catch (IOException e) { errorContext(); error("ioexception"); throw e; } catch (Exception e) { errorContext(); error("exception", e.getClass().getName(), e.getMessage()); e.printStackTrace(); } catch (ThreadDeath e) { errorContext(); error("terminated"); e.printStackTrace(); throw e;

As you can see, the RuntimeException gets caught as an Exception and it is printed on the console, but does not get propagated - which is probably an error in the jdk.

The parsing continues and leads now to another Exception in java.util.Stack#peek. An EmptyStackException gets thrown, which has no message. That exceptions message (null) is printed.

We could change the jmeter code to display the full exception when the message is null, but I think the real culprit is the jdk.

The OP should probably correct the HTML and all is well (for him at least).

I will attach the two stacktraces and a simple test to reproduce the issue. Just run it in jmeter, got to the tree view and try to display the sample as html.

asfimport commented 8 years ago

Shivansh (migrated from Bugzilla): If your point is correctly then can you please tell me that how come the application is working correctly on Google chrome and other Browsers .

asfimport commented 8 years ago

Sebb (migrated from Bugzilla): (In reply to Felix Schumacher from comment 8)

We could change the jmeter code to display the full exception when the message is null, but I think the real culprit is the jdk.

Agreed, we should display more info in this case. Probably sensible to log the stack trace as well. Also agree that the JVM implementation is broken as it does not propagate the error.

asfimport commented 8 years ago

Sebb (migrated from Bugzilla): (In reply to Shivansh from comment 9)

If your point is correctly then can you please tell me that how come the application is working correctly on Google chrome and other Browsers .

Browsers are generally very lenient when parsing HTML.

There's nothing that JMeter can do here other than display better info about the error. It relies on the Java runtime for parsing the HTML.

Note that lenient parsing relies on making assumptions about what the causes of errors are and how to fix them. If the browser makes the wrong assumptions, the page may still look OK, but may have subtle incorrect behaviour changes.

The proper solution is to fix the page so that the HTML is valid.

asfimport commented 8 years ago

@FSchumacher (migrated from Bugzilla): Created attachment bug59632-example.jmx: Example jmx with minimal html code to reproduce issue

bug59632-example.jmx ````xml false false continue false 1 1 1 1464632976000 1464632976000 false Sleep_Time 100 = Sleep_Mask 0xFF = Label = ResponseCode = ResponseMessage = Status OK = SamplerData = ResultData <html><body><div style='"'>foo</div></body></html> = org.apache.jmeter.protocol.java.test.JavaTest false saveConfig true true true true true true true false true true false false false true false false false true 0 true true true ````
asfimport commented 8 years ago

@FSchumacher (migrated from Bugzilla): Created attachment bug59632-emptystackexc.log: Stacktrace of the exception, that jmeter can catch

bug59632-emptystackexc.log ```` 2016/05/29 13:32:14 INFO - jmeter.visualizers.RenderAsHTML: Failed to parse HTML java.util.EmptyStackException >-------at java.util.Stack.peek(Stack.java:102) >-------at javax.swing.text.DefaultStyledDocument$ElementBuffer.insertElement(DefaultStyledDocument.java:1827) >-------at javax.swing.text.DefaultStyledDocument$ElementBuffer.create(DefaultStyledDocument.java:1488) >-------at javax.swing.text.DefaultStyledDocument.create(DefaultStyledDocument.java:149) >-------at javax.swing.text.html.HTMLDocument.create(HTMLDocument.java:469) >-------at javax.swing.text.html.HTMLDocument$HTMLReader.flushBuffer(HTMLDocument.java:3731) >-------at javax.swing.text.html.HTMLDocument$HTMLReader.flush(HTMLDocument.java:2533) >-------at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:263) >-------at javax.swing.JEditorPane.setText(JEditorPane.java:1415) >-------at org.apache.jmeter.visualizers.RenderAsHTML.showRenderedResponse(RenderAsHTML.java:105) >-------at org.apache.jmeter.visualizers.RenderAsHTML.showRenderedResponse(RenderAsHTML.java:58) >-------at org.apache.jmeter.visualizers.RenderAsHTML.renderResult(RenderAsHTML.java:54) >-------at org.apache.jmeter.visualizers.ViewResultsFullVisualizer.valueChanged(ViewResultsFullVisualizer.java:268) >-------at javax.swing.JTree.fireValueChanged(JTree.java:2924) >-------at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:3383) >-------at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:634) >-------at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelectionModel.java:1092) >-------at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSelectionModel.java:293) >-------at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelectionModel.java:187) >-------at javax.swing.JTree.setSelectionPath(JTree.java:1631) >-------at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2393) >-------at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3609) >-------at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3548) >-------at java.awt.Component.processMouseEvent(Component.java:6513) >-------at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) >-------at java.awt.Component.processEvent(Component.java:6281) >-------at java.awt.Container.processEvent(Container.java:2229) >-------at java.awt.Component.dispatchEventImpl(Component.java:4872) >-------at java.awt.Container.dispatchEventImpl(Container.java:2287) >-------at java.awt.Component.dispatchEvent(Component.java:4698) >-------at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) >-------at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4489) >-------at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) >-------at java.awt.Container.dispatchEventImpl(Container.java:2273) >-------at java.awt.Window.dispatchEventImpl(Window.java:2719) >-------at java.awt.Component.dispatchEvent(Component.java:4698) >-------at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:747) >-------at java.awt.EventQueue.access$300(EventQueue.java:103) >-------at java.awt.EventQueue$3.run(EventQueue.java:706) >-------at java.awt.EventQueue$3.run(EventQueue.java:704) >-------at java.security.AccessController.doPrivileged(Native Method) >-------at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) >-------at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) >-------at java.awt.EventQueue$4.run(EventQueue.java:720) >-------at java.awt.EventQueue$4.run(EventQueue.java:718) >-------at java.security.AccessController.doPrivileged(Native Method) >-------at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) >-------at java.awt.EventQueue.dispatchEvent(EventQueue.java:717) >-------at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) >-------at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) >-------at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) >-------at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) >-------at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) >-------at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) ````
asfimport commented 8 years ago

@FSchumacher (migrated from Bugzilla): Created attachment bug59632-quote-stack.log: Stacktrace that gets written to stdout by jdk

bug59632-quote-stack.log ```` [java] java.lang.RuntimeException: Unclosed " [java] at javax.swing.text.html.CSSParser.readTill(CSSParser.java:674) [java] at javax.swing.text.html.CSSParser.nextToken(CSSParser.java:484) [java] at javax.swing.text.html.CSSParser.parseIdentifiers(CSSParser.java:374) [java] at javax.swing.text.html.CSSParser.parseDeclaration(CSSParser.java:347) [java] at javax.swing.text.html.CSSParser.parseDeclarationBlock(CSSParser.java:325) [java] at javax.swing.text.html.CSSParser.parse(CSSParser.java:150) [java] at javax.swing.text.html.StyleSheet$CssParser.parse(StyleSheet.java:3187) [java] at javax.swing.text.html.StyleSheet$CssParser.parseDeclaration(StyleSheet.java:3171) [java] at javax.swing.text.html.StyleSheet$CssParser.parseDeclaration(StyleSheet.java:3162) [java] at javax.swing.text.html.StyleSheet.getDeclaration(StyleSheet.java:323) [java] at javax.swing.text.html.HTMLDocument$HTMLReader.handleStartTag(HTMLDocument.java:2619) [java] at javax.swing.text.html.parser.DocumentParser.handleStartTag(DocumentParser.java:160) [java] at javax.swing.text.html.parser.Parser.startTag(Parser.java:437) [java] at javax.swing.text.html.parser.Parser.parseTag(Parser.java:1956) [java] at javax.swing.text.html.parser.Parser.parseContent(Parser.java:2074) [java] at javax.swing.text.html.parser.Parser.parse(Parser.java:2248) [java] at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:122) [java] at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:101) [java] at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:262) [java] at javax.swing.JEditorPane.setText(JEditorPane.java:1415) [java] at org.apache.jmeter.visualizers.RenderAsHTML.showRenderedResponse(RenderAsHTML.java:105) [java] at org.apache.jmeter.visualizers.RenderAsHTML.showRenderedResponse(RenderAsHTML.java:58) [java] at org.apache.jmeter.visualizers.RenderAsHTML.renderResult(RenderAsHTML.java:54) [java] at org.apache.jmeter.visualizers.ViewResultsFullVisualizer.valueChanged(ViewResultsFullVisualizer.java:268) [java] at org.apache.jmeter.visualizers.ViewResultsFullVisualizer.actionPerformed(ViewResultsFullVisualizer.java:394) [java] at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1260) [java] at javax.swing.JComboBox.setSelectedItem(JComboBox.java:588) [java] at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:624) [java] at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:835) [java] at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290) [java] at java.awt.Component.processMouseEvent(Component.java:6516) [java] at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) [java] at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:499) [java] at java.awt.Component.processEvent(Component.java:6281) [java] at java.awt.Container.processEvent(Container.java:2229) [java] at java.awt.Component.dispatchEventImpl(Component.java:4872) [java] at java.awt.Container.dispatchEventImpl(Container.java:2287) [java] at java.awt.Component.dispatchEvent(Component.java:4698) [java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) [java] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) [java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) [java] at java.awt.Container.dispatchEventImpl(Container.java:2273) [java] at java.awt.Window.dispatchEventImpl(Window.java:2719) [java] at java.awt.Component.dispatchEvent(Component.java:4698) [java] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:747) [java] at java.awt.EventQueue.access$300(EventQueue.java:103) [java] at java.awt.EventQueue$3.run(EventQueue.java:706) [java] at java.awt.EventQueue$3.run(EventQueue.java:704) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) [java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) [java] at java.awt.EventQueue$4.run(EventQueue.java:720) [java] at java.awt.EventQueue$4.run(EventQueue.java:718) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:717) [java] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) [java] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) [java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) [java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) ````
asfimport commented 8 years ago

@pmouawad (migrated from Bugzilla): Shouldn't we report a bug to Oracle ?