{"record":{"id":"b1b39c2b7bb7e7e2","repo":"apache/seatunnel","slug":"continuous-discovery-scheduler-does-not-terminate","errorCode":null,"errorMessage":"Continuous discovery scheduler does not terminate in 5 seconds.","messagePattern":"Continuous discovery scheduler does not terminate in 5 seconds\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/split/ContinuousMultipleTableFileSourceSplitEnumerator.java","lineNumber":226,"sourceCode":"                this::safeScanOnce,\n                0L,\n                Math.max(1L, scanInterval.toMillis()),\n                TimeUnit.MILLISECONDS);\n    }\n\n    @Override\n    public void run() {\n        // Assign splits on demand via handleSplitRequest.\n    }\n\n    @Override\n    public void close() throws IOException {\n        closed = true;\n        if (scheduler != null) {\n            scheduler.shutdownNow();\n            try {\n                if (!scheduler.awaitTermination(5, TimeUnit.SECONDS)) {\n                    log.warn(\"Continuous discovery scheduler does not terminate in 5 seconds.\");\n                }\n            } catch (InterruptedException e) {\n                Thread.currentThread().interrupt();\n            }\n        }\n        for (TableScanContext ctx : tableScanContexts) {\n            ctx.close();\n        }\n    }\n\n    @Override\n    public void addSplitsBack(List<FileSourceSplit> splits, int subtaskId) {\n        if (splits == null || splits.isEmpty()) {\n            return;\n        }\n        synchronized (lock) {\n            for (FileSourceSplit split : splits) {\n                inFlightSplits.remove(split);","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/split/ContinuousMultipleTableFileSourceSplitEnumerator.java#L208-L244","documentation":"During close(), the enumerator shuts down its scheduled continuous-discovery executor and waits up to 5 seconds for termination via awaitTermination. If the scheduler has not terminated within that window, this warning is logged and close() proceeds anyway. It indicates a scan task is still running (possibly blocked on slow filesystem I/O) and may have been interrupted mid-flight by shutdownNow.","triggerScenarios":"Calling close() while a scanOnce is running and taking longer than 5 seconds — e.g. a stuck or very slow directory listing against a remote filesystem, or a task ignoring interruption.","commonSituations":"Job cancellation/restart while a continuous file discovery scan is in progress against slow or hanging HDFS/S3; network stalls making filesystem metadata calls block longer than the 5s grace period.","solutions":["Investigate why scans are slow: check filesystem/network health and scan interval settings","Ensure scanOnce does not block indefinitely (add timeouts to filesystem operations)","If the warning recurs at shutdown only and no corruption occurs, it can be treated as benign and ignored"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    scheduler.awaitTermination(5, TimeUnit.SECONDS);\n} catch (InterruptedException e) {\n    Thread.currentThread().interrupt();\n}\n// if awaitTermination returned false, log and continue; check for stuck FS operations","preventionTips":["Keep scanOnce fast: avoid unbounded listing of huge directories in a single tick","Add timeouts to filesystem operations used by the scan","Investigate recurring occurrences: they signal blocked FS/network calls, not just slow shutdown"],"tags":["file-connector","scheduler","shutdown","timeout"],"backgroundTag":"request-timeout","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"}