Consul: lock command is not stop child on SIGTERM

Created on 16 Dec 2017  路  3Comments  路  Source: hashicorp/consul

consul version for both Client and Server

Client: v1.0.1
Server: v1.0.1

consul info for both Client and Server

Client:

agent:
    check_monitors = 0
    check_ttls = 0
    checks = 1
    services = 1
build:
    prerelease = 
    revision = 9564c29
    version = 1.0.1
consul:
    bootstrap = false
    known_datacenters = 1
    leader = true
    leader_addr = 172.21.0.5:8300
    server = true
raft:
    applied_index = 74
    commit_index = 74
    fsm_pending = 0
    last_contact = 0
    last_log_index = 74
    last_log_term = 2
    last_snapshot_index = 0
    last_snapshot_term = 0
    latest_configuration = [{Suffrage:Voter ID:b3bc687e-d34d-3482-6cc4-5db5b4a933d6 Address:172.21.0.5:8300}]
    latest_configuration_index = 1
    num_peers = 0
    protocol_version = 3
    protocol_version_max = 3
    protocol_version_min = 0
    snapshot_version_max = 1
    snapshot_version_min = 0
    state = Leader
    term = 2
runtime:
    arch = amd64
    cpu_count = 8
    goroutines = 78
    max_procs = 8
    os = linux
    version = go1.9.2
serf_lan:
    coordinate_resets = 0
    encrypted = false
    event_queue = 1
    event_time = 2
    failed = 0
    health_score = 0
    intent_queue = 0
    left = 0
    member_time = 1
    members = 1
    query_queue = 0
    query_time = 1
serf_wan:
    coordinate_resets = 0
    encrypted = false
    event_queue = 0
    event_time = 1
    failed = 0
    health_score = 0
    intent_queue = 0
    left = 0
    member_time = 1
    members = 1
    query_queue = 0
    query_time = 1

Server:

agent:
    check_monitors = 0
    check_ttls = 0
    checks = 0
    services = 0
build:
    prerelease = 
    revision = 9564c29
    version = 1.0.1
consul:
    bootstrap = false
    known_datacenters = 1
    leader = true
    leader_addr = 127.0.0.1:8300
    server = true
raft:
    applied_index = 6
    commit_index = 6
    fsm_pending = 0
    last_contact = 0
    last_log_index = 6
    last_log_term = 2
    last_snapshot_index = 0
    last_snapshot_term = 0
    latest_configuration = [{Suffrage:Voter ID:ec0d5310-1da8-19af-6f9e-91df70675889 Address:127.0.0.1:8300}]
    latest_configuration_index = 1
    num_peers = 0
    protocol_version = 3
    protocol_version_max = 3
    protocol_version_min = 0
    snapshot_version_max = 1
    snapshot_version_min = 0
    state = Leader
    term = 2
runtime:
    arch = amd64
    cpu_count = 8
    goroutines = 71
    max_procs = 8
    os = linux
    version = go1.9.2
serf_lan:
    coordinate_resets = 0
    encrypted = false
    event_queue = 1
    event_time = 2
    failed = 0
    health_score = 0
    intent_queue = 0
    left = 0
    member_time = 1
    members = 1
    query_queue = 0
    query_time = 1
serf_wan:
    coordinate_resets = 0
    encrypted = false
    event_queue = 0
    event_time = 1
    failed = 0
    health_score = 0
    intent_queue = 0
    left = 0
    member_time = 1
    members = 1
    query_queue = 0
    query_time = 1

Operating system and Environment details

Gentoo Linux.
Server is running in docker 17.06.2-ce, using consul:latest.
Client is running in docker 17.06.2-ce, using alpine-based image and https://releases.hashicorp.com/consul/1.0.1/consul_1.0.1_linux_amd64.zip.

Description of the Issue (and unexpected/desired result)

I expect when consul lock get SIGTERM it should deliver it to the child - it looks like this was implemented in #827 - but this isn't happens (SIGINT works).

Reproduction steps

Acquiring lock and starting child:

/ # consul lock l1 exec sleep 600 &
/ # ps ax
PID   USER     TIME   COMMAND
   64 root       0:00 sh
  121 root       0:00 consul lock l1 exec sleep 600
  132 root       0:00 sleep 600
  133 root       0:00 ps ax

Trying to stop child by sending SIGTERM to consul:

/ # kill 121; sleep 3; ps ax
PID   USER     TIME   COMMAND
   64 root       0:00 sh
  121 root       0:00 consul lock l1 exec sleep 600
  132 root       0:00 sleep 600
  135 root       0:00 ps ax

This doesn't work.

Trying to stop child by sending SIGINT to consul:

/ # kill -INT 121; sleep 3; ps ax
Error running handler: signal: interrupt
PID   USER     TIME   COMMAND
   64 root       0:00 sh
  137 root       0:00 ps ax
[1]+  Done                       consul lock l1 exec sleep 600

This works.

Log Fragments or Link to gist

N/A

themcli typbug

Most helpful comment

This appears to have been introduced in v1.0.1. Please prioritize this fix.

All 3 comments

We are also facing the same issue.

We are also facing the same issue.

@neerajb also on v1.0.1? (We're seeing this, too, on v1.0.1).

This appears to have been introduced in v1.0.1. Please prioritize this fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wing731 picture wing731  路  3Comments

runswithd6s picture runswithd6s  路  3Comments

sandstrom picture sandstrom  路  3Comments

mooneygr picture mooneygr  路  4Comments

nicholasjackson picture nicholasjackson  路  3Comments