You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "zhouzhengde (Jira)" <ji...@apache.org> on 2021/06/23 07:44:00 UTC

[jira] [Created] (FLINK-23117) TaskExecutor.allocateSlot is a logical error

zhouzhengde created FLINK-23117:
-----------------------------------

             Summary: TaskExecutor.allocateSlot is a logical error
                 Key: FLINK-23117
                 URL: https://issues.apache.org/jira/browse/FLINK-23117
             Project: Flink
          Issue Type: Bug
          Components: Runtime / Task
    Affects Versions: 1.13.1, 1.13.0, 1.12.2, 1.12.0
            Reporter: zhouzhengde


(commit: 2020-04-22)TaskExecutor.allocateSlot at line 1109 has a logical error. Use '!taskSlotTable.isAllocated(slotId.getSlotNumber(), jobId, allocationId)' to judge TaskSlot is used by another job that is not correct.  if slot index not occupy, that will be have some problem. Please confirm that is correct. The issue code follow: 

- TaskExecutor.java
```java

{color:red}} else if (!taskSlotTable.isAllocated(slotId.getSlotNumber(), jobId, allocationId)) {{color}
 final String message =
 "The slot " + slotId + " has already been allocated for a different job.";

 log.info(message);

 final AllocationID allocationID =
 taskSlotTable.getCurrentAllocation(slotId.getSlotNumber());
 throw new SlotOccupiedException(
 message, allocationID, taskSlotTable.getOwningJob(allocationID));
}
```

- TaskSlotTableImpl.java
```java
    @Override
    public boolean isAllocated(int index, JobID jobId, AllocationID allocationId) {
        TaskSlot<T> taskSlot = taskSlots.get(index);
        if (taskSlot != null) {
            return taskSlot.isAllocated(jobId, allocationId);
        } else {
            return false;
        }
    }
```





--
This message was sent by Atlassian Jira
(v8.3.4#803005)