consul/command
Frank Schroeder ea5b0f2c7c agent: fix 'consul leave' shutdown race (#2880)
When the agent is triggered to shutdown via an external 'consul leave'
command delivered via the HTTP API then the client expects to receive a
response when the agent is down. This creates a race on when to shutdown
the agent itself like the RPC server, the checks and the state and the
external endpoints like DNS and HTTP.

This patch splits the shutdown process into two parts:

 * shutdown the agent
 * shutdown the endpoints (http and dns)

They can be executed multiple times, concurrently and in any order but
should be executed first agent, then endpoints to provide consistent
behavior across all use cases. Both calls have to be executed for a
proper shutdown.

This could be partially hidden in a single function but would introduce
some magic that happens behind the scenes which one has to know of but
isn't obvious.

Fixes #2880
2017-06-21 05:52:51 +02:00
..
agent.go agent: fix 'consul leave' shutdown race (#2880) 2017-06-21 05:52:51 +02:00
agent_test.go pkg refactor 2017-06-10 18:52:45 +02:00
base.go Moves config util helpers into their own package. (#3165) 2017-06-20 10:49:37 -07:00
commands.go pkg refactor 2017-06-10 18:52:45 +02:00
configtest.go Moves flag slice helper into configutil. 2017-06-20 12:52:35 -07:00
configtest_test.go pkg refactor 2017-06-10 18:52:45 +02:00
event.go pkg refactor 2017-06-10 18:52:45 +02:00
event_test.go pkg refactor 2017-06-10 18:52:45 +02:00
exec.go pkg refactor 2017-06-10 18:52:45 +02:00
exec_test.go pkg refactor 2017-06-10 18:52:45 +02:00
force_leave.go pkg refactor 2017-06-10 18:52:45 +02:00
force_leave_test.go pkg refactor 2017-06-10 18:52:45 +02:00
info.go pkg refactor 2017-06-10 18:52:45 +02:00
info_test.go pkg refactor 2017-06-10 18:52:45 +02:00
join.go pkg refactor 2017-06-10 18:52:45 +02:00
join_test.go pkg refactor 2017-06-10 18:52:45 +02:00
keygen.go pkg refactor 2017-06-10 18:52:45 +02:00
keygen_test.go pkg refactor 2017-06-10 18:52:45 +02:00
keyring.go pkg refactor 2017-06-10 18:52:45 +02:00
keyring_test.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_command.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_command_test.go test: run command tests in parallel 2017-05-31 00:29:25 +02:00
kv_delete.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_delete_test.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_export.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_export_test.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_get.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_get_test.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_import.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_import_test.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_put.go pkg refactor 2017-06-10 18:52:45 +02:00
kv_put_test.go pkg refactor 2017-06-10 18:52:45 +02:00
leave.go pkg refactor 2017-06-10 18:52:45 +02:00
leave_test.go pkg refactor 2017-06-10 18:52:45 +02:00
lock.go pkg refactor 2017-06-10 18:52:45 +02:00
lock_test.go pkg refactor 2017-06-10 18:52:45 +02:00
maint.go pkg refactor 2017-06-10 18:52:45 +02:00
maint_test.go pkg refactor 2017-06-10 18:52:45 +02:00
members.go pkg refactor 2017-06-10 18:52:45 +02:00
members_test.go pkg refactor 2017-06-10 18:52:45 +02:00
monitor.go pkg refactor 2017-06-10 18:52:45 +02:00
operator.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_autopilot.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_autopilot_get.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_autopilot_get_test.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_autopilot_set.go Moves config util helpers into their own package. (#3165) 2017-06-20 10:49:37 -07:00
operator_autopilot_set_test.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_autopilot_test.go test: run command tests in parallel 2017-05-31 00:29:25 +02:00
operator_raft.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_raft_list.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_raft_list_test.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_raft_remove.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_raft_remove_test.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_raft_test.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_test.go test: run command tests in parallel 2017-05-31 00:29:25 +02:00
reload.go pkg refactor 2017-06-10 18:52:45 +02:00
reload_test.go pkg refactor 2017-06-10 18:52:45 +02:00
rtt.go pkg refactor 2017-06-10 18:52:45 +02:00
rtt_test.go pkg refactor 2017-06-10 18:52:45 +02:00
snapshot_command.go golint: Rename fields and structs 2017-04-25 09:26:13 -07:00
snapshot_command_test.go test: run command tests in parallel 2017-05-31 00:29:25 +02:00
snapshot_inspect.go pkg refactor 2017-06-10 18:52:45 +02:00
snapshot_inspect_test.go pkg refactor 2017-06-10 18:52:45 +02:00
snapshot_restore.go pkg refactor 2017-06-10 18:52:45 +02:00
snapshot_restore_test.go pkg refactor 2017-06-10 18:52:45 +02:00
snapshot_save.go pkg refactor 2017-06-10 18:52:45 +02:00
snapshot_save_test.go pkg refactor 2017-06-10 18:52:45 +02:00
util_test.go test: refactor command tests to use TestAgent 2017-05-31 00:29:24 +02:00
util_unix.go command: fix Windows build 2015-01-25 05:00:52 +01:00
util_windows.go docs: describe child process handling on Windows for lock command 2015-01-25 11:42:29 +01:00
validate.go Moves flag slice helper into configutil. 2017-06-20 12:52:35 -07:00
validate_test.go pkg refactor 2017-06-10 18:52:45 +02:00
version.go pkg refactor 2017-06-10 18:52:45 +02:00
version_test.go test: run command tests in parallel 2017-05-31 00:29:25 +02:00
watch.go pkg refactor 2017-06-10 18:52:45 +02:00
watch_test.go pkg refactor 2017-06-10 18:52:45 +02:00