{"record":{"id":"5bdd5a5cb5ce0ba9","repo":"apache/druid","slug":"lock-s-is-revoked","errorCode":null,"errorMessage":"Lock[%s] is revoked","messagePattern":"Lock\\[(.+?)\\] is revoked","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeTask.java","lineNumber":156,"sourceCode":"\n  @Override\n  public TaskStatus runTask(TaskToolbox toolbox) throws Exception\n  {\n    // Group partitionLocations by interval and partitionId\n    final Map<Interval, Int2ObjectMap<List<PartitionLocation>>> intervalToBuckets = new HashMap<>();\n    for (PartitionLocation location : ioConfig.getPartitionLocations()) {\n      intervalToBuckets.computeIfAbsent(location.getInterval(), k -> new Int2ObjectOpenHashMap<>())\n                       .computeIfAbsent(location.getBucketId(), k -> new ArrayList<>())\n                       .add(location);\n    }\n\n    final List<TaskLock> locks = toolbox.getTaskActionClient().submit(\n        new SurrogateAction<>(getSupervisorTaskId(), new LockListAction())\n    );\n    final Map<Interval, String> intervalToVersion = Maps.newHashMapWithExpectedSize(locks.size());\n    locks.forEach(lock -> {\n      if (lock.isRevoked()) {\n        throw new ISE(\"Lock[%s] is revoked\", lock);\n      }\n      final String mustBeNull = intervalToVersion.put(lock.getInterval(), lock.getVersion());\n      if (mustBeNull != null) {\n        throw new ISE(\n            \"Unexpected state: Two versions([%s], [%s]) for the same interval[%s]\",\n            lock.getVersion(),\n            mustBeNull,\n            lock.getInterval()\n        );\n      }\n    });\n\n    final Stopwatch fetchStopwatch = Stopwatch.createStarted();\n    final Map<Interval, Int2ObjectMap<List<File>>> intervalToUnzippedFiles = fetchSegmentFiles(\n        toolbox,\n        intervalToBuckets\n    );\n    final long fetchTime = fetchStopwatch.elapsed(TimeUnit.SECONDS);","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeTask.java#L138-L174","documentation":"PartialSegmentMergeTask runs under a surrogate lock taken on behalf of its supervisor task. At startup it lists the supervisor's locks via SurrogateAction(LockListAction); if any listed lock has been revoked (e.g. lost due to a segment being published by another task or lock timeout), the task aborts immediately with this ISE.","triggerScenarios":"The timeChunk/time interval lock held by the supervisor parallel task was revoked before or during the partial merge task run - commonly because the lock's interval was superseded by another task or the lock request version was overwritten.","commonSituations":"Concurrent ingestion or compaction targeting overlapping intervals; supervisor task retry after its locks were reassigned; slow merge tasks outliving their lock validity; metadata store failover issues.","solutions":["Rerun the supervisor batch task so it acquires fresh locks before spawning partial merge tasks.","Check for other ingestion/compaction tasks competing for the same intervals and stagger them.","Review Overlord logs around lock revocation to see which task stole or revoked the lock.","Verify task lock configuration (lock timeout, force-time-chunk-lock) matches the workload."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (IllegalStateException e) { if (e.getMessage().matches(\".*Lock\\[.*\\] is revoked.*\")) { /* rerun supervisor to reacquire locks */ } else { throw e; } }","preventionTips":["Prevent overlapping ingestion/compaction on the same intervals.","Keep partial merge tasks fast so locks aren't held long.","Review Overlord lock-revocation logs when scheduling concurrent batch jobs."],"tags":["druid","task-locks","batch-ingestion","concurrency"],"backgroundTag":"lock-revoked","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}