Nomad register service to consul with the same service id even there is no related allocations

there is a unhealthy service on consul: _nomad-task-9dac4939-8f0f-eb2c-c368-929ffd46cfeb-server-server-http

first. I check nomad alloc by nomad alloc status 9dac4939-8f0f-eb2c-c368-929ffd46cfeb, and alloc exists. so I stop it.

but service still exist in consul. so manually deregister it by consul services deregister -id=_nomad-task-9dac4939-8f0f-eb2c-c368-929ffd46cfeb-server-server-http

after that it still appears again and again, even there is no allocation with id 9dac4939-8f0f-eb2c-c368-929ffd46cfeb

what happened and how to remove this service.

How was the alloc stopped @einsone? If you used the alloc stop command I’d expect Nomad to take care of the deregistration. Otherwise if the task was simply killed (e.g. kill -9) there’s a period where Nomad will continue to manage the service in Consul until it detects the down task and reschedules it, and also updates the service registrations in Consul on a periodic sync.

Also, which version of Nomad?