{"record":{"id":"7d7da1bec234f8af","repo":"apache/druid","slug":"skipping-kill-task-scheduling-because-thread-is-in","errorCode":null,"errorMessage":"Skipping kill task scheduling because thread is interrupted.","messagePattern":"Skipping kill task scheduling because thread is interrupted\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"server/src/main/java/org/apache/druid/server/coordinator/duty/KillUnusedSegments.java","lineNumber":250,"sourceCode":"                intervalToKill,\n                null,\n                maxSegmentsToKill,\n                maxUsedStatusLastUpdatedTime\n            ),\n            true\n        );\n        ++submittedTasks;\n        datasourceToLastKillIntervalEnd.put(dataSource, intervalToKill.getEnd());\n\n        // Termination conditions.\n        if (remainingDatasourcesToKill.isEmpty() || submittedTasks >= availableKillTaskSlots) {\n          break;\n        }\n      }\n      catch (Exception ex) {\n        log.error(ex, \"Failed to submit kill task for dataSource[%s] in interval[%s]\", dataSource, intervalToKill);\n        if (Thread.currentThread().isInterrupted()) {\n          log.warn(\"Skipping kill task scheduling because thread is interrupted.\");\n          break;\n        }\n      }\n    }\n\n    log.info(\n        \"Submitted [%d] kill tasks for [%d] datasources: [%s]. Remaining [%d] datasources to kill: [%s].\",\n        submittedTasks,\n        dataSourcesToKill.size() - remainingDatasourcesToKill.size(),\n        Sets.difference(dataSourcesToKill, remainingDatasourcesToKill),\n        remainingDatasourcesToKill.size(),\n        remainingDatasourcesToKill\n    );\n\n    stats.add(Stats.Kill.SUBMITTED_TASKS, submittedTasks);\n  }\n\n  @Nullable","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/server/coordinator/duty/KillUnusedSegments.java#L232-L268","documentation":"KillUnusedSegments.runInternal() submits kill tasks per datasource/interval; when a submit fails and the coordinator thread has been interrupted (shutdown in progress), it logs this warning and stops scheduling further kill tasks for this run. It prevents the duty cycle from fighting shutdown.","triggerScenarios":"During the coordinator's kill duty loop, remoteTaskService/taskQueue submission fails (e.g.RejectedExecutionException during shutdown) while Thread.currentThread().isInterrupted() is true.","commonSituations":"Coordinator graceful shutdown or leadership loss mid-duty-cycle; coordinator being killed while kill-task scheduling is running; overloaded task queue rejecting submissions.","solutions":["No action needed if it occurs during planned shutdown — the loop resumes next duty cycle after restart","If frequent at other times, check coordinator liveness/leader stability","Verify task queue capacity and overlord health so kill-task submits do not fail","Check ZK/HTTP connectivity between coordinator and overlord"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// warning indicates shutdown; only act if seen outside shutdown\nif (!shuttingDown && logsContain(\"Skipping kill task scheduling\")) {\n  pageCoordinatorOwner();\n}","preventionTips":["Perform coordinator restarts during low-traffic windows","Keep the overlord/task queue healthy so kill submissions don't fail","Monitor coordinator leadership stability (leader elections mid-cycle cause this)","Verify kill duty config (druid.coordinator.kill.*) so cycles complete quickly"],"tags":["interruption","coordinator","kill-tasks","shutdown"],"backgroundTag":"thread-interrupted","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}