{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/consul-template/issues/442","repository_url":"https://api.github.com/repos/hashicorp/consul-template","labels_url":"https://api.github.com/repos/hashicorp/consul-template/issues/442/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/consul-template/issues/442/comments","events_url":"https://api.github.com/repos/hashicorp/consul-template/issues/442/events","html_url":"https://github.com/hashicorp/consul-template/issues/442","id":112490985,"number":442,"title":"issue with haproxy reloads","user":{"login":"consultantRR","id":4399454,"avatar_url":"https://avatars.githubusercontent.com/u/4399454?v=3","gravatar_id":"","url":"https://api.github.com/users/consultantRR","html_url":"https://github.com/consultantRR","followers_url":"https://api.github.com/users/consultantRR/followers","following_url":"https://api.github.com/users/consultantRR/following{/other_user}","gists_url":"https://api.github.com/users/consultantRR/gists{/gist_id}","starred_url":"https://api.github.com/users/consultantRR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/consultantRR/subscriptions","organizations_url":"https://api.github.com/users/consultantRR/orgs","repos_url":"https://api.github.com/users/consultantRR/repos","events_url":"https://api.github.com/users/consultantRR/events{/privacy}","received_events_url":"https://api.github.com/users/consultantRR/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/consul-template/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/hashicorp/consul-template/labels/upstream-bug","name":"upstream-bug","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":94,"created_at":"2015-10-21T01:02:01Z","updated_at":"2016-03-23T11:04:12Z","closed_at":"2016-02-18T16:55:46Z","body":"Using consul-template (`v0.11.0`) with haproxy, I am seeing an issue in which multiple haproxy processes stack up over time as consul-template rewrites the haproxy.cfg file and fires off the reload command.\r\n\r\nIn this scenario, consul-template is running as root.\r\n\r\nHere is the config:\r\n\r\n```\r\nconsul = \"127.0.0.1:8500\"\r\n\r\ntemplate {\r\n  source = \"/etc/haproxy/haproxy.template\"\r\n  destination = \"/etc/haproxy/haproxy.cfg\"\r\n  command = \"haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf $( cat /var/run/haproxy.pid )\"\r\n}\r\n```\r\n\r\nManually running the reload command (`haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf $( cat /var/run/haproxy.pid`) works fine and does not stack up multiple haproxy processes.\r\n\r\nBut, for example, after a few consul-template rewrites of haproxy.cfg, here is what I see:\r\n\r\n```\r\n10258 ?        Ss     0:00 haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf 10029\r\n10262 ?        Ss     0:00 haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf 10258\r\n10270 ?        Ss     0:00 haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf 10266\r\n10369 ?        Ss     0:00 haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf 10365\r\n10427 ?        Ss     0:00 haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf 10423\r\n10483 ?        Ss     0:00 haproxy -f /etc/haproxy/haproxy.cfg -q -p /var/run/haproxy.pid -sf 10479\r\n```\r\n\r\nAny thoughts on what might be happening here, and why the behavior differs from consul-template running this reload command, and my running this reload command manually (outside the purview of consul-template) from a shell?\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/consul-template/issues/comments/200297669","html_url":"https://github.com/hashicorp/consul-template/issues/442#issuecomment-200297669","issue_url":"https://api.github.com/repos/hashicorp/consul-template/issues/442","id":200297669,"user":{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T11:04:12Z","updated_at":"2016-03-23T11:04:12Z","body":"Hi everyone,\r\n\r\nSince this issue seems to be getting a lot of noise, I'm going to clarify that this has been _fixed_ in Consul Template 0.13+. Please open any other concerns as separate issues. haproxy itself _will leave behind_ previous processes for a short period of time to finish existing requests, so unless you see a multitude of haproxy processes running each time CT restarts the process, this issue does not apply to you :smile:  "}}