Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system job leaks service registration #9360

Closed
fredwangwang opened this issue Nov 13, 2020 · 3 comments · Fixed by #9736
Closed

system job leaks service registration #9360

fredwangwang opened this issue Nov 13, 2020 · 3 comments · Fixed by #9736

Comments

@fredwangwang
Copy link
Contributor

Nomad version

0.12.5

Operating system and Environment details

linux + Consul 1.8.3

Issue

tested:
When removing the additional service stanzas from system type jobs and redeploy, the service registration leaks (not removed from Consul).

Reproduction steps

  1. Deploy the job file below
  2. Remove the following
-    service {
-      name = "example-service-2"
-      port = "api"
-    }
  1. Redeploy the job file
  2. The service registration still in Consul, and will remain there even after the job is stopped and gc-ed.

Job file (if appropriate)

job "example-system-job" {
  region      = "global"
  datacenters = ["dc1"]
  type        = "system"

  group "example-service-api-group" {
    count = 1

    network {
      mode = "bridge"
      port api  {}
    }

    service {
      name = "example-service-2"
      port = "api"
    }

    service {
      name = "example-service"
      port = "api"
      
      # this check seems have to be here, otherwise it will not trigger this bug.
      check {
        type     = "http"
        port     = "api"
        path     = "/ready"
        interval = "5s"
        timeout  = "1s"
      }
    }

    task "example-fake" {
      driver = "docker"

      config {
        image = "nicholasjackson/fake-service:v0.12.0"
      }

      env {
        LISTEN_ADDR = "0.0.0.0:${NOMAD_PORT_api}"
      }
    }
  }
}
@drewbailey
Copy link
Contributor

@fredwangwang Thank you for reporting, sorry you are running into this. I've tracked the issue down to the scheduler, when an inplace update is made (like removing or updating a service block) the allocations shared (group) ports are dropped. I've created #9735 to track and will have a fix soon.

@fredwangwang
Copy link
Contributor Author

@drewbailey thanks for investigating!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants