prestodb/presto · warning · QueryPreprocessorException

Interrupted while preprocessing query

Error message

Interrupted while preprocessing query

What it means

QueryPreprocessor.preprocessQueryInternal catches InterruptedException while preparing the query and rethrows it as QueryPreprocessorException('Interrupted while preprocessing query') after restoring the interrupt flag. This happens when the thread running query preprocessing (e.g. the CLI's exit hook or session setup) is interrupted during shutdown.

Source

Thrown at presto-cli/src/main/java/com/facebook/presto/cli/QueryPreprocessor.java:163

                        throw e.getCause();
                    }

                    // wait for process to finish
                    exitCode = process.waitFor();
                }
                finally {
                    process.destroyForcibly();
                    if (writeOutput != null) {
                        writeOutput.cancel(true);
                    }
                }
            }
            catch (QueryPreprocessorException e) {
                throw e;
            }
            catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new QueryPreprocessorException("Interrupted while preprocessing query");
            }
            catch (Throwable e) {
                throw new QueryPreprocessorException("Error preprocessing query: " + e.getMessage(), e);
            }

            // check we got a valid exit code
            if (exitCode != 0) {
                Optional<String> errorMessage = tryGetFutureValue(readStderr, 100, MILLISECONDS)
                        .flatMap(value -> Optional.ofNullable(emptyToNull(value.trim())));

                throw new QueryPreprocessorException("Query preprocessor exited " + exitCode +
                        errorMessage.map(message1 -> "\n===\n" + message1 + "\n===").orElse(""));
            }
            return result;
        });

        try {
            return task.get(timeout.toMillis(), MILLISECONDS);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. This usually indicates intentional cancellation — rerun the query once the interruption cause is removed
  2. Avoid sending SIGINT/timeout before preprocessing completes; raise shell timeout values
  3. If it appears unexpectedly, check for other code interrupting shared threads and ensure the interrupt flag is honored for clean shutdown
Defensive patterns

Strategy: retry

Try / catch

try { preprocess(query); } catch (QueryPreprocessorException e) { if ("Interrupted while preprocessing query".equals(e.getMessage())) { /* deliberate cancel: exit cleanly, don't rethrow as failure */ } else throw e; }

Prevention

When it happens

Trigger: The thread executing preprocessQuery is interrupted — typically Ctrl-C / SIGINT terminating the CLI while the query is still being preprocessed, or a timeout cancelling the thread.

Common situations: User cancels a hanging presto session during startup; orchestration kills the CLI mid-preprocessing; long-running --file preprocessing interrupted by a shell timeout.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/07e9a8b17107bc08. Report an issue: GitHub.