{"record":{"id":"1c49bcf98082f97e","repo":"apache/seatunnel","slug":"scheduler-timed-out-during-close-up-to-ringbuf","errorCode":null,"errorMessage":"Scheduler timed out during close; up to {} ringbuffer event(s) were not flushed to disk. Local buffer (cap={}) will be drained as fallback.","messagePattern":"Scheduler timed out during close; up to (.+?) ringbuffer event\\(s\\) were not flushed to disk\\. Local buffer \\(cap=(.+?)\\) will be drained as fallback\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/event/JobEventLocalFileHandler.java","lineNumber":422,"sourceCode":"            } catch (IOException e) {\n                log.error(\"Failed to flush events on close\", e);\n            }\n        } else {\n            // Scheduler did not stop within the timeout.  Interrupt it so any blocking\n            // Hazelcast call (readManyAsync / CompletableFuture.join) is unblocked.\n            scheduledExecutorService.shutdownNow();\n            boolean finallyTerminated = false;\n            try {\n                finallyTerminated = scheduledExecutorService.awaitTermination(2, TimeUnit.SECONDS);\n            } catch (InterruptedException e) {\n                Thread.currentThread().interrupt();\n            }\n            // Log how many ringbuffer events may have been skipped for observability.\n            try {\n                long tail = ringbuffer.tailSequence();\n                long unsynced = tail - committedEventIndex + 1;\n                if (unsynced > 0) {\n                    log.warn(\n                            \"Scheduler timed out during close; up to {} ringbuffer event(s) were\"\n                                    + \" not flushed to disk. Local buffer (cap={}) will be drained\"\n                                    + \" as fallback.\",\n                            unsynced,\n                            LOCAL_EVENT_BUFFER_CAPACITY);\n                }\n            } catch (Exception e) {\n                log.warn(\n                        \"Scheduler timed out during close; relying on local buffer as fallback.\"\n                                + \" Could not determine dropped event count: {}\",\n                        e.getMessage());\n            }\n            if (!finallyTerminated) {\n                // The scheduler thread is still alive even after shutdownNow().  Draining\n                // the local buffer here would race with the scheduler on writerLock.\n                // closing=true already prevents the scheduler from opening new files,\n                // so we can safely close the current writer under the lock and return.\n                log.warn(","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/event/JobEventLocalFileHandler.java#L404-L440","documentation":"During close(), if the report scheduler does not terminate within the timeout, the handler estimates how many ring buffer events were not flushed to disk (tailSequence - committedEventIndex + 1) and logs this warning, noting that the in-memory local buffer (capacity LOCAL_EVENT_BUFFER_CAPACITY) will be drained as a fallback.","triggerScenarios":"JobEventLocalFileHandler.close() is called while the scheduler is still running (awaitTermination timed out) and tailSequence() is ahead of committedEventIndex, so some events may never reach the trace file.","commonSituations":"Cluster/node shutdown while trace events are being produced faster than the scheduler drains them; disk I/O slowness delaying the write loop past the shutdown timeout.","solutions":["Ensure the scheduler can drain promptly — check disk write throughput and trace event volume.","Increase the scheduler shutdown timeout in close() if large backlogs are expected.","Rely on the local buffer fallback, but note events beyond its capacity are lost; reduce trace verbosity at high throughput."],"exampleFix":"null","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { handler.close(); } catch (Exception e) { log.warn(\"trace handler close incomplete; some events may be unflushed\", e); }","preventionTips":["Ensure adequate disk throughput for trace volume.","Close handlers during graceful shutdown before other resources.","Tune shutdown timeout to expected backlog drain time."],"tags":["shutdown","scheduler","timeout","observability"],"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"}