Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/938#discussion_r139877947
--- Diff:
common/src/main/java/org/apache/drill/common/exceptions/UserException.java ---
@@ -536,6 +542,33 @@ public Builder pushContext(final String name, final
double value) {
* @return user exception
*/
public UserException build(final Logger logger) {
+
+ // To allow for debugging:
+ // A spinner code to make the execution stop here while the file
'/tmp/drillspin' exists
+ // Can be used to attach a debugger, use jstack, etc
+ // The processID of the spinning thread should be in a file like
/tmp/spin4148663301172491613.tmp
+ // along with the error message.
+ File spinFile = new File("/tmp/drillspin");
+ if ( spinFile.exists() ) {
+ File tmpDir = new File("/tmp");
+ File outErr = null;
+ try {
+ outErr = File.createTempFile("spin", ".tmp", tmpDir);
+ BufferedWriter bw = new BufferedWriter(new FileWriter(outErr));
+ bw.write("Spinning process: " +
ManagementFactory.getRuntimeMXBean().getName()
+ /* After upgrading to JDK 9 - replace with:
ProcessHandle.current().getPid() */);
+ bw.write("\nError cause: " +
+ (errorType == DrillPBError.ErrorType.SYSTEM ? ("SYSTEM ERROR:
" + ErrorHelper.getRootMessage(cause)) : message));
+ bw.close();
+ } catch (Exception ex) {
+ logger.warn("Failed creating a spinner tmp message file: {}",
ex);
+ }
+ while (spinFile.exists()) {
+ try { sleep(1_000); } catch (Exception ex) { /* ignore
interruptions */ }
--- End diff --
What happens it the fragment executor tries to kill the query? Do we want
the spinner to ignore that request here?
---