Bug 59632 - HTML format the "Failed to Parse HTML : NULL" error message is displayed.
Summary: HTML format the "Failed to Parse HTML : NULL" error message is displayed.
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.13
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-25 11:31 UTC by Shivansh
Modified: 2016-07-31 19:04 UTC (History)
1 user (show)



Attachments
Failed to Parse HTML : NULL error message is displayed. (122.72 KB, image/png)
2016-05-25 11:31 UTC, Shivansh
Details
Text Output for Error Page (80.78 KB, text/plain)
2016-05-28 18:04 UTC, Shivansh
Details
Example jmx with minimal html code to reproduce issue (6.33 KB, application/xml)
2016-05-30 18:33 UTC, Felix Schumacher
Details
Stacktrace of the exception, that jmeter can catch (4.34 KB, text/plain)
2016-05-30 18:35 UTC, Felix Schumacher
Details
Stacktrace that gets written to stdout by jdk (5.13 KB, text/plain)
2016-05-30 18:37 UTC, Felix Schumacher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shivansh 2016-05-25 11:31:58 UTC
Created attachment 33888 [details]
Failed to Parse HTML : NULL error message is displayed.

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.
Comment 1 Sebb 2016-05-26 10:11:12 UTC
Comment on attachment 33888 [details]
Failed to Parse HTML : NULL error message is displayed.

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?
Comment 2 Shivansh 2016-05-27 05:00:40 UTC
I am Testing it on my Local server , so no such link is available for it.
Comment 3 Shivansh 2016-05-27 09:48:00 UTC
In Jmeter Log file no such message is displayed.
Comment 4 Shivansh 2016-05-27 09:49:34 UTC
Can i help you by providing some other details.
Comment 5 Sebb 2016-05-27 10:08:01 UTC
(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.
Comment 6 Shivansh 2016-05-28 18:04:16 UTC
Created attachment 33900 [details]
Text Output for Error Page
Comment 7 Shivansh 2016-05-28 18:07:23 UTC
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.
Comment 8 Felix Schumacher 2016-05-29 11:50:43 UTC
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.
Comment 9 Shivansh 2016-05-29 12:06:04 UTC
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 .
Comment 10 Sebb 2016-05-29 13:01:49 UTC
(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.
Comment 11 Sebb 2016-05-29 13:13:53 UTC
(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.
Comment 12 Felix Schumacher 2016-05-30 18:33:43 UTC
Created attachment 33902 [details]
Example jmx with minimal html code to reproduce issue
Comment 13 Felix Schumacher 2016-05-30 18:35:12 UTC
Created attachment 33903 [details]
Stacktrace of the exception, that jmeter can catch
Comment 14 Felix Schumacher 2016-05-30 18:37:27 UTC
Created attachment 33904 [details]
Stacktrace that gets written to stdout by jdk
Comment 15 Philippe Mouawad 2016-07-31 19:04:39 UTC
Shouldn't we report  a bug to Oracle ?