[ 
https://issues.apache.org/jira/browse/HIVE-15387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Barna Zsombor Klara updated HIVE-15387:
---------------------------------------
    Attachment: HIVE-15387.1.patch

There is a race condition in the handling of the SQLOperationDisplay classes. 
Once an operation is complete/cancelled/timed out we move the 
SQLOperationDisplay from the live stack to the historical one. But the runtime 
is only updated once the state is set, after the SQLOperationDisplay is already 
among the historical queries.


> NPE in HiveServer2 webUI Historical SQL Operations section
> ----------------------------------------------------------
>
>                 Key: HIVE-15387
>                 URL: https://issues.apache.org/jira/browse/HIVE-15387
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Barna Zsombor Klara
>            Priority: Minor
>         Attachments: HIVE-15387.1.patch
>
>
> The runtime value on a SQLOperationDisplay may be null, which may lead to 
> NPEs on the web UI.
> Stack trace:
> {code}
> java.lang.NullPointerException
>       at 
> org.apache.hive.generated.hiveserver2.hiveserver2_jsp._jspService(hiveserver2_jsp.java:145)
>       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>       at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
>       at 
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
>       at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
>       at org.eclipse.jetty.server.Server.handle(Server.java:349)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:910)
>       at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
>       at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
>       at 
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
>       at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
>       at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
>       at java.lang.Thread.run(Thread.java:745)
> {code}
> Compiled jsp segment:
> {code}
>  124        out.print( 
> conf.get(ConfVars.HIVE_SERVER2_WEBUI_MAX_HISTORIC_QUERIES.varname) );
>    125        out.write(" Closed Queries</h2>\n<table id=\"attributes_table\" 
> class=\"table table-striped\">\n    <tr>\n        <th>User Name</th>\n        
> <th>Query</th>\n        <th>Execution Engine</th>\n        <th>State</th>\n   
>      <th>Opened (s)</th>\n        <th>Closed Timestamp</th>\n        
> <th>Latency (s)</th>\n        <th>Drilldown Link</th>\n    </tr>\n    ");
>    126  
>    127        queries = 0;
>    128        operations = 
> sessionManager.getOperationManager().getHistoricalSQLOperations();
>    129        for (SQLOperationDisplay operation : operations) {
>    130            queries++;
>    131      
>    132        out.write("\n    <tr>\n        <td>");
>    133        out.print( operation.getUserName() );
>    134        out.write("</td>\n        <td>");
>    135        out.print( operation.getQueryDisplay() == null ? "Unknown" : 
> operation.getQueryDisplay().getQueryString() );
>    136        out.write("</td>\n        <td>");
>    137        out.print( operation.getExecutionEngine() );
>    138        out.write("\n        <td>");
>    139        out.print( operation.getState() );
>    140        out.write("</td>\n        <td>");
>    141        out.print( operation.getElapsedTime()/1000 );
>    142        out.write("</td>\n        <td>");
>    143        out.print( operation.getEndTime() == null ? "In Progress" : new 
> Date(operation.getEndTime()) );
>    144        out.write("</td>\n        <td>");
>    145        out.print( operation.getRuntime()/1000 );
>    146        out.write("</td>\n        ");
> {code}
> Still trying to find a way to easily reproduce the issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to