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

Health check removed when deregister not-linked service #5456

Closed
vfrz opened this issue Mar 9, 2019 · 1 comment
Closed

Health check removed when deregister not-linked service #5456

vfrz opened this issue Mar 9, 2019 · 1 comment

Comments

@vfrz
Copy link
Contributor

vfrz commented Mar 9, 2019

Overview of the Issue

I have two service registered with one health check per service, when I deregister the first service, the health check of the second get deregistered but continue to check.

** Fix proposal PR: #5457 **

Reproduction Steps

  1. Create Service 1 with params:
ID = "service1"
Name = "Service 1"
  1. Create Service 2 with params:
ID = "service2"
Name = "Service 2"
  1. Create Check 1 with params:
ID = "check1"
Name = "Check 1"
ServiceID = "service1"
  1. Create Check 2 with params:
ID = "check2"
Name = "Check 2"
ServiceID = "service2"
  1. Deregister Service 1
  2. List checks using /agent/checks endpoint
  3. Check 2 has been deregistered but still running (see it in the console / log)

(8. After restarting Consul, Check 2 is appearing again)

Consul and environment info

Using Consul v1.4.3 on Windows 10 x64

Can't reproduce using v1.4.2, the bug was surely introduced with this commit: 2aac4d5

I'll update the issue alongside my research.

ShimmerGlass pushed a commit to ShimmerGlass/consul that referenced this issue Mar 10, 2019
vfrz pushed a commit to vfrz/consul that referenced this issue Mar 10, 2019
@pschultz
Copy link

Script for easy reproducing (run consul agent -dev -node=localhost first):

# Register two service instances
for port in 31508 31226; do
    jq --arg port $port -n '{
        "Address": "127.0.0.1",
        "Port": $port|tonumber,
        "Check": {
            "Interval": "5s",
            "HTTP": ("http://localhost:"+$port+"/health-check")
        },
        "Name": "my-service",
        "ID": ("my-service-"+$port)
    }' | curl -XPUT localhost:8500/v1/agent/service/register -d@-
done

# Verify two checks exist (plus Consul's usual serfHealth check)
curl localhost:8500/v1/health/node/localhost

# Deregister *one* instance
consul services deregister -id my-service-31508

# Only Consul's serfHealth check remains
curl localhost:8500/v1/health/node/localhost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants