kkhatua commented on a change in pull request #1379: DRILL-6591: Show Exception 
for failed queries submitted in WebUI
URL: https://github.com/apache/drill/pull/1379#discussion_r202432457
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
 ##########
 @@ -97,21 +97,22 @@ public QueryResult run(final WorkManager workManager, 
final WebUserConnection we
 
     //Fail if nearly out of heap space
     if (nearlyOutOfHeapSpace) {
+      UserException almostOutOfHeapException = UserException.resourceError()
+          .message("There is not enough heap memory to run this query using 
the web interface. ")
+          .addContext("Please try a query with fewer columns or with a filter 
or limit condition to limit the data returned. ")
+          .addContext("You can also try an ODBC/JDBC client. ")
+          .build(logger);
+      //Add event
       workManager.getBee().getForemanForQueryId(queryId)
-        .addToEventQueue(QueryState.FAILED,
-            UserException.resourceError(
-                new Throwable(
-                    "There is not enough heap memory to run this query using 
the web interface. "
-                    + "Please try a query with fewer columns or with a filter 
or limit condition to limit the data returned. "
-                    + "You can also try an ODBC/JDBC client. "
-                    )
-                )
-              .build(logger)
-            );
+        .addToEventQueue(QueryState.FAILED, almostOutOfHeapException);
+      //Return NearlyOutOfHeap exception
+      throw almostOutOfHeapException;
 
 Review comment:
   I added the exception originally to the event queue, but I'm not sure if 
that will necessarily propagate the exception back. If it isn't thrown back, 
there is a possibility that before the eventQueue is handled, the resultSet 
will make it back to the WebServer  that will start constructing the 
JSONResponse object and run out of memory there.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to