[
https://issues.apache.org/jira/browse/DRILL-6760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16678224#comment-16678224
]
ASF GitHub Bot commented on DRILL-6760:
---------------------------------------
arina-ielchiieva commented on a change in pull request #1519: DRILL-6760:
Retain original exception in Verbose Error Message
URL: https://github.com/apache/drill/pull/1519#discussion_r231496451
##########
File path:
common/src/main/java/org/apache/drill/common/util/DrillExceptionUtils.java
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.common.util;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.drill.exec.proto.UserBitShared;
+
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+
+public class DrillExceptionUtils {
+ static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(DrillExceptionUtils.class);
+
+ public static Throwable getThrowable(UserBitShared.DrillPBError error) {
+ UserBitShared.ExceptionWrapper wrapper = error.getException();
+ return getThrowable(wrapper);
+ }
+
+ /**
+ * recreate throwable from exception PB which received from remote or local
node.
+ * if no match ctor found, the base Throwable(Exception or Error) is created
as a substitution
+ *
+ * @param exceptionWrapper the exception PB
+ * @return Throwable deserialized from PB
+ */
+ public static Throwable getThrowable(UserBitShared.ExceptionWrapper
exceptionWrapper) {
+ String className = exceptionWrapper.getExceptionClass();
+ if (StringUtils.isBlank(className) ||
exceptionWrapper.getStackTraceCount() < 1) {
+ return null;
+ }
+ Throwable inner = getThrowable(exceptionWrapper.getCause());
+ try {
+ Throwable throwable = getInstance(className,
exceptionWrapper.getMessage(), inner);
+ int size = exceptionWrapper.getStackTraceCount();
+ StackTraceElement[] stackTrace = new StackTraceElement[size];
+ for (int i = 0; i < size; ++i) {
+ UserBitShared.StackTraceElementWrapper w =
exceptionWrapper.getStackTrace(i);
+ stackTrace[i] = new StackTraceElement(w.getClassName(),
w.getMethodName(), w.getFileName(), w.getLineNumber());
+ }
+ throwable.setStackTrace(stackTrace);
+ return throwable;
+ } catch (Throwable t) {
+ logger.error("Failed to get throwable from PB", t);
+ return null;
+ }
+ }
+
+ private static Throwable getInstance(String className, String message,
Throwable inner) throws ReflectiveOperationException {
Review comment:
Please add java doc.
----------------------------------------------------------------
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:
[email protected]
> The Profiles page does not retain the original exception if the query fails
> ---------------------------------------------------------------------------
>
> Key: DRILL-6760
> URL: https://issues.apache.org/jira/browse/DRILL-6760
> Project: Apache Drill
> Issue Type: Bug
> Components: Web Server
> Affects Versions: 1.14.0
> Reporter: Nitin Sharma
> Priority: Major
> Fix For: 1.15.0
>
>
> The profiles page (that shows query execution for the most recently issued
> queries) on the foreman node does not retain the original exception if the
> query failed. The error always says "Remote Drill Exception" and gives an id.
> The actual exception could be anything from OOM, s3 access errors, out of
> disk issue etc but they seem to get swallowed.
>
> It is hard to debug if there are long running queries.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)