moby / moby/swarmkit

Synchronous service removal

Open
#2,497 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/orchestration kind/enhancement
Dominant language
Go
Stars
3.7k
Forks
676
Avg merge
4d 9h
Merged PRs (30d)
6

Description

Since we support synchronous service create and update (https://github.com/moby/moby/pull/31144), it would be worthwhile to think about synchronous service removals.

One of the reasons for this is the following: Currently the service object is deleted right away, while tasks are set to desired state REMOVE, and eventually removed when the containers are stopped. During the period when shutdown is happening, it is impossible to inspect these tasks because the service object doesn't exist, which makes for bad UX and issues that are extremely difficult for the user to debug.

There are two ways to do this:

  1. (easy way): Keep the service object around when a service delete event comes in. The task reaper then while removing tasks with desired state REMOVE and actual state >=SHUTDOWN also ensures that once all tasks are gone, the service object is removed.
  2. (harder way): End to end API change, so docker service rm would actually wait for the removals to go through completely (with a possible --detached mode). This would require the above change, and more.

Either way, let's discuss whether this makes sense and what the right approach is.

cc @anshulpundir @dperny @tiborvass @stevvooe @aluzzardi @thaJeztah @marcusmartins

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked synchronous service create/update change and the service deletion flow described here, including the task reaper and docker service rm. Determine whether retaining the service until all REMOVE tasks are gone is sufficient or whether an end-to-end synchronous API change is needed. Done means an agreed approach with defined removal and inspection behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.