apache/seatunnel · error · IOException

Source fetch execution was fail

Error message

Source fetch execution was fail

What it means

FetchTask.run() performs one fetch cycle (SplitReader.fetch()) and enqueues records. Any IOException or InterruptedException during that cycle is rethrown as an IOException with this message, since the code assumes such failures 'should only happen on shutdown'. The exception is then recorded by the fetcher thread and surfaced via SplitFetcherManager.checkErrors().

Source

Thrown at seatunnel-connectors-v2/connector-common/src/main/java/org/apache/seatunnel/connectors/seatunnel/common/source/reader/fetcher/FetchTask.java:73

                log.debug("Fetch records from split fetcher {}", fetcherIndex);
            }

            if (!isWakeup()) {
                if (elementsQueue.offer(lastRecords, OFFER_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) {
                    if (!lastRecords.finishedSplits().isEmpty()) {
                        splitFinishedCallback.accept(lastRecords.finishedSplits());
                    }
                    lastRecords = null;
                    log.debug("Enqueued records from split fetcher {}", fetcherIndex);
                } else {
                    log.debug(
                            "Enqueuing timed out in split fetcher {}, queue is blocked",
                            fetcherIndex);
                }
            }
        } catch (IOException | InterruptedException e) {
            // this should only happen on shutdown
            throw new IOException("Source fetch execution was fail", e);
        } finally {
            // clean up the potential wakeup effect.
            if (isWakeup()) {
                wakeup = false;
            }
        }
    }

    @Override
    public void wakeUp() {
        // Set the wakeup flag first.
        wakeup = true;

        if (lastRecords == null) {
            splitReader.wakeUp();
        } else {
            // interrupt enqueuing the records
            // or waitting records offer into queue timeout, see {@link #run()}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the cause chain: if the cause is an InterruptedException during shutdown it is benign — check job status first
  2. If cause is IOException, fix the underlying source connectivity (timeouts, credentials, network) that the SplitReader hit
  3. Ensure the source is not being shut down concurrently with reads (split lifecycle ordering)
  4. Wrap flaky remote reads in the SplitReader with retry/backoff so transient IO errors don't kill the fetcher
Defensive patterns

Strategy: retry

Validate before calling

// before running the job, validate source reachability
boolean ok = sourceReader.checkConnection(); // e.g. broker/host reachable
if (!ok) throw new IllegalStateException("source unreachable, aborting before fetch");

Try / catch

try {
    fetcherManager.checkErrors();
} catch (RuntimeException e) {
    Throwable root = e.getCause();
    if (root instanceof InterruptedException) {
        LOG.info("fetch interrupted during shutdown, ignoring");
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: SplitReader.fetch() or handleSplitsChanges throws IOException (network/db reader failure), or the fetcher thread is interrupted while enqueuing or waiting — typically during task cancellation/shutdown.

Common situations: Job cancelled or failed while the fetcher is mid-fetch; underlying source (Kafka/JDBC/file) connection drops; user calls reader.wakeUp() plus shutdown and the thread gets interrupted; queue blocked and interrupted on stop.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/70843610fb24c6c7. Report an issue: GitHub.