[Core] If condition flaw in `worker.IsAvailableForScheduling`
What happened + What you expected to happen
I noticed a logic flaw at src/ray/raylet/worker.h:
!GetAssignedTaskId().IsNil()might beGetAssignedTaskId().IsNil().
bool IsAvailableForScheduling() const {
return !IsDead() // Not dead
&& !GetAssignedTaskId().IsNil() // No assigned task
&& !IsBlocked() // Not blocked
&& GetActorId().IsNil(); // No assigned actor
}
Worker is available for scheduling, if no task is assigned.
- But
!GetAssignedTaskId().IsNil()means assigned task id is not nil, which is not consistent with comment// No assigned task.
IsAvailableForScheduling is only used for resource deadlock detection, in WarnResourceDeadlock, so this flaw might cause subtle bug in resource management.
Versions / Dependencies
- Ray: 1.13.0
Reproduction script
No reproduction script.
Issue Severity
Low: It annoys or frustrates me.
src/ray/raylet/node_manager.cc
for (const auto &worker : worker_pool_.GetAllRegisteredWorkers()) {
if (worker->IsAvailableForScheduling()) {
// Progress is being made in a task, don't warn.
resource_deadlock_warned_ = 0;
return;
}
}
Maybe the comment // No assigned task is wrong, but the condition is correct?
// - If there's no available workers for scheduling
// - But if there are still pending tasks waiting for resource acquisition
Hi, I'm a bot from the Ray team :)
To help human contributors to focus on more relevant issues, I will automatically add the stale label to issues that have had no activity for more than 4 months.
If there is no further activity in the 14 days, the issue will be closed!
- If you'd like to keep the issue open, just leave any comment, and the stale label will be removed!
- If you'd like to get more attention to the issue, please tag one of Ray's contributors.
You can always ask for help on our discussion forum or Ray's public slack channel.