{"record":{"id":"70843610fb24c6c7","repo":"apache/seatunnel","slug":"source-fetch-execution-was-fail","errorCode":null,"errorMessage":"Source fetch execution was fail","messagePattern":"Source fetch execution was fail","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-common/src/main/java/org/apache/seatunnel/connectors/seatunnel/common/source/reader/fetcher/FetchTask.java","lineNumber":73,"sourceCode":"                log.debug(\"Fetch records from split fetcher {}\", fetcherIndex);\n            }\n\n            if (!isWakeup()) {\n                if (elementsQueue.offer(lastRecords, OFFER_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) {\n                    if (!lastRecords.finishedSplits().isEmpty()) {\n                        splitFinishedCallback.accept(lastRecords.finishedSplits());\n                    }\n                    lastRecords = null;\n                    log.debug(\"Enqueued records from split fetcher {}\", fetcherIndex);\n                } else {\n                    log.debug(\n                            \"Enqueuing timed out in split fetcher {}, queue is blocked\",\n                            fetcherIndex);\n                }\n            }\n        } catch (IOException | InterruptedException e) {\n            // this should only happen on shutdown\n            throw new IOException(\"Source fetch execution was fail\", e);\n        } finally {\n            // clean up the potential wakeup effect.\n            if (isWakeup()) {\n                wakeup = false;\n            }\n        }\n    }\n\n    @Override\n    public void wakeUp() {\n        // Set the wakeup flag first.\n        wakeup = true;\n\n        if (lastRecords == null) {\n            splitReader.wakeUp();\n        } else {\n            // interrupt enqueuing the records\n            // or waitting records offer into queue timeout, see {@link #run()}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-common/src/main/java/org/apache/seatunnel/connectors/seatunnel/common/source/reader/fetcher/FetchTask.java#L55-L91","documentation":"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().","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the cause chain: if the cause is an InterruptedException during shutdown it is benign — check job status first","If cause is IOException, fix the underlying source connectivity (timeouts, credentials, network) that the SplitReader hit","Ensure the source is not being shut down concurrently with reads (split lifecycle ordering)","Wrap flaky remote reads in the SplitReader with retry/backoff so transient IO errors don't kill the fetcher"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before running the job, validate source reachability\nboolean ok = sourceReader.checkConnection(); // e.g. broker/host reachable\nif (!ok) throw new IllegalStateException(\"source unreachable, aborting before fetch\");","typeGuard":null,"tryCatchPattern":"try {\n    fetcherManager.checkErrors();\n} catch (RuntimeException e) {\n    Throwable root = e.getCause();\n    if (root instanceof InterruptedException) {\n        LOG.info(\"fetch interrupted during shutdown, ignoring\");\n    } else {\n        throw e;\n    }\n}","preventionTips":["Distinguish shutdown-time InterruptedException from real IO failures via the cause chain","Add retry/backoff inside custom SplitReader implementations for transient source errors","Avoid interrupting fetcher threads outside shutdown flows","Keep source connection timeouts below job-level timeouts so failures surface clearly"],"tags":["fetcher","interruption","io","source-connector"],"backgroundTag":"network-request-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}