Potential race condition in scheduler?
@anshulpundir is already working on this.
Since Jun 5, 2018.
- Dominant language
- Go
- Stars
- 3.7k
- Forks
- 676
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 6
Description
I noticed a few instances in manager/scheduler/scheduler.go where some checks seem suspect. In particular, we're doing something like
// Ignore all tasks that have not reached PENDING
// state and tasks that no longer consume resources.
if t.Status.State < api.TaskStatePending || t.Status.State > api.TaskStateRunning {
continue
}
in three places:
-
https://github.com/docker/swarmkit/blob/master/manager/scheduler/scheduler.go#L71
-
https://github.com/docker/swarmkit/blob/master/manager/scheduler/scheduler.go#L206
-
https://github.com/docker/swarmkit/blob/master/manager/scheduler/scheduler.go#L243
From the comment, it seems like we're assuming that tasks with current state > RUNNING do not consume resources, which is no longer true with https://github.com/docker/swarmkit/pull/2461. For the brief period where the task reaper hasn't deleted some tasks, I'm trying to figure out if the task reaper could race with the scheduler here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.