[
https://issues.apache.org/jira/browse/FLINK-23117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gabriel Nes updated FLINK-23117:
--------------------------------
Attachment: image-2021-10-11-10-23-14-069.png
> 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.12.0, 1.12.2, 1.13.0, 1.13.1
> Reporter: zhouzhengde
> Priority: Minor
> Attachments: image-2021-10-11-10-11-28-390.png,
> image-2021-10-11-10-16-17-977.png, image-2021-10-11-10-23-14-069.png
>
>
> (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)