Cleaning up old failed tasks?
naemono opened this issue · 2 comments
This is more of a question than an issue.
i was wondering why I was getting duplicative service ids for the same service, even though it was an old deployment of the service.
from here:
https://github.com/CiscoCloud/mesos-consul/blob/master/mesos/mesos.go#L150-L158
It appears that only running tasks are investigated.
I'm seeing this in my setup:
http://myhost:8500/v1/catalog/service/nginx-test
[
{"Node":"iadmesos1.here.com","Address":"10.57.128.114","ServiceID":"mesos-consul:10.57.128.114:nginx-test:31678","ServiceName":"nginx-test","ServiceTags":["nginx-test","mmontgomery","dev"],"ServiceAddress":"192.168.200.2","ServicePort":31678,"ServiceEnableTagOverride":false,"CreateIndex":1330,"ModifyIndex":1330},
{"Node":"iadmesos1.here.com","Address":"10.57.128.114","ServiceID":"mesos-consul:10.57.128.114:nginx-test:31679","ServiceName":"nginx-test","ServiceTags":["nginx-test","mmontgomery","dev"],"ServiceAddress":"192.168.200.2","ServicePort":31679,"ServiceEnableTagOverride":false,"CreateIndex":1331,"ModifyIndex":1331},
{"Node":"iadmesos1.here.com","Address":"10.57.128.114","ServiceID":"mesos-consul:10.57.128.114:nginx-test:31889","ServiceName":"nginx-test","ServiceTags":["nginx-test","mmontgomery","dev"],"ServiceAddress":"192.168.200.4","ServicePort":31889,"ServiceEnableTagOverride":false,"CreateIndex":1108,"ModifyIndex":1108},
{"Node":"iadmesos1.here.com","Address":"10.57.128.114","ServiceID":"mesos-consul:10.57.128.114:nginx-test:31890","ServiceName":"nginx-test","ServiceTags":["nginx-test","mmontgomery","dev"],"ServiceAddress":"192.168.200.4","ServicePort":31890,"ServiceEnableTagOverride":false,"CreateIndex":1109,"ModifyIndex":1109},
{"Node":"iadmesos1.here.com","Address":"10.57.128.114","ServiceID":"mesos-consul:10.57.128.114:nginx-test:31902","ServiceName":"nginx-test","ServiceTags":[],"ServiceAddress":"192.168.200.3","ServicePort":31902,"ServiceEnableTagOverride":false,"CreateIndex":1043,"ModifyIndex":1043},
{"Node":"iadmesos1.here.com","Address":"10.57.128.114","ServiceID":"mesos-consul:10.57.128.114:nginx-test:31903","ServiceName":"nginx-test","ServiceTags":[],"ServiceAddress":"192.168.200.3","ServicePort":31903,"ServiceEnableTagOverride":false,"CreateIndex":1044,"ModifyIndex":1044}
]
Only one of these tasks is actually active.
Does de-registration not remove these?
Thanks for any further insight you can give.
Ok, digging through the code this morning, I think I've found the issue.
Here:
https://github.com/CiscoCloud/mesos-consul/blob/master/mesos/mesos.go#L161
You're not checking if an error was returned from m.Registry.Deregister()
This seems more appropriate:
// Remove completed tasks
err := m.Registry.Deregister()
if err != nil {
log.Error(err)
}
I'll get a PR for this shortly.