Consul-template version 0.18.1 hanging on restart (systemd)

772 views
Skip to first unread message

Zane Williamson

unread,
Apr 4, 2017, 6:45:49 PM4/4/17
to Consul
Hi All,

We are seeing consul-template (0.18.1) hanging when systemd sends it's /bin/kill -HUP $MAINPID

The only way I've been able to get it to restart is with an aggressive TimeoutSec=10s where it will send a kill -9 I believe.

Anyone else dealing with a similar issue on this version?

Here is my systemd config. We are running this on Ubuntu 16.04 LTS

[Unit]
Description=consul-template
Requires=network-online.target
After=network-online.target consul.service

[Service]
Restart=always
ExecStart=/usr/local/bin/consul-template -config=/etc/consul-template.d
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
PIDFile=/var/run/consul-template.pid
TimeoutSec=10s

[Install]
WantedBy=multi-user.target


When I remove "TimeoutSec=10s" systemd restart consul-template will just hang. Maybe it is a global systemd configuration I have misconfigured? 

Any advice is appreciated

-Zane

Chris Stevens

unread,
Apr 7, 2017, 10:44:40 AM4/7/17
to Consul
Zane,

Did you get anywhere with this? File an issue?

I have a similar setup and might be experiencing the same issue.

Zane Williamson

unread,
Apr 7, 2017, 11:57:45 AM4/7/17
to Consul

I haven't filed an issue yet. I believe consul-template updated to Golang 1.8 with recent release and perhaps the signal handling changed. Probably worth filing an issue and taking a look at the code since this is probably affecting others.


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Consul" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/consul-tool/9ht5l2Ok4BQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to consul-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/758c5b8b-2ad7-40b0-b847-d97b3fa1f015%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
-Zane

Zane Williamson

unread,
Apr 7, 2017, 12:51:38 PM4/7/17
to Consul
Looked through the consul-template code/docs some more. It appears not all OS signals are passed to child processes and some of this behavior is now configurable. Looks like default settings allow SIGINT to stop running process cleanly. Let me see what that means for the systemd configuration, but I'm thinking KillSignal=SIGINT will need to be added.
--
-Zane

Zane Williamson

unread,
Apr 7, 2017, 1:09:37 PM4/7/17
to Consul
Ok, just tested this on Vagrant xenial64 box... adding

KillSignal=SIGINT

Is what we need to work with newer versions of consul-template 
--
-Zane

Zane Williamson

unread,
Apr 7, 2017, 1:10:09 PM4/7/17
to Consul
Clarifying... adding KillSignal=SIGINT to /etc/systemd/system/consul-template.service
--
-Zane

Chris Stevens

unread,
Apr 7, 2017, 1:57:59 PM4/7/17
to Consul
Sounds good. What does your service block look like then?

this?

[Service]
Restart=always
ExecStart=/usr/local/bin/consul-template -config=/etc/consul-template.d
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
KillSignal=SIGINT
PIDFile=/var/run/consul-template.pid

Chris Stevens

unread,
Apr 7, 2017, 2:03:55 PM4/7/17
to Consul
I can confirm that this is working well for me right now with your suggestion:

[Service]
ExecStart ....
....
KillSignal=SIGINT
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5


Reply all
Reply to author
Forward
0 new messages