open-nomad/command
Mahmood Ali 60ee243149 fix crash when executor parent nomad process dies
Fixes https://github.com/hashicorp/nomad/issues/5593

Executor seems to die unexpectedly after nomad agent dies or is
restarted.  The crash seems to occur at the first log message after
the nomad agent dies.

To ease debugging we forward executor log messages to executor.log as
well as to Stderr.  `go-plugin` sets up plugins with Stderr pointing to
a pipe being read by plugin client, the nomad agent in our case[1].
When the nomad agent dies, the pipe is closed, and any subsequent
executor logs fail with ErrClosedPipe and SIGPIPE signal.  SIGPIPE
results into executor process dying.

I considered adding a handler to ignore SIGPIPE, but hc-log library
currently panics when logging write operation fails[2]

This we opt to revert to v0.8 behavior of exclusively writing logs to
executor.log, while we investigate alternative options.

[1] https://github.com/hashicorp/nomad/blob/v0.9.0/vendor/github.com/hashicorp/go-plugin/client.go#L528-L535
[2] https://github.com/hashicorp/nomad/blob/v0.9.0/vendor/github.com/hashicorp/go-hclog/int.go#L320-L323
2019-04-23 09:52:46 -04:00
..
agent Merge pull request #5512 from hashicorp/dani/f-alloc-stop 2019-04-23 13:05:08 +02:00
test-resources Refactor spawn-daemon so it can be used by all OSes and make it write exit code to a file 2015-10-28 16:23:33 -07:00
acl.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
acl_bootstrap.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
acl_bootstrap_test.go spelling: bootstrap 2018-03-11 17:43:19 +00:00
acl_policy.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
acl_policy_apply.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
acl_policy_apply_test.go Rename TestAgent.Token to TestAgent.RootToken 2017-10-06 14:35:14 -07:00
acl_policy_delete.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
acl_policy_delete_test.go Rename TestAgent.Token to TestAgent.RootToken 2017-10-06 14:35:14 -07:00
acl_policy_info.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
acl_policy_info_test.go policy list and token self commands 2017-10-13 16:31:46 -07:00
acl_policy_list.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
acl_policy_list_test.go List does json/template 2017-10-13 16:37:33 -07:00
acl_token.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
acl_token_create.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
acl_token_create_test.go Rename TestAgent.Token to TestAgent.RootToken 2017-10-06 14:35:14 -07:00
acl_token_delete.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
acl_token_delete_test.go Rename TestAgent.Token to TestAgent.RootToken 2017-10-06 14:35:14 -07:00
acl_token_info.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
acl_token_info_test.go Rename TestAgent.Token to TestAgent.RootToken 2017-10-06 14:35:14 -07:00
acl_token_list.go cli: add acl token list command, documentation 2019-04-12 15:48:36 +00:00
acl_token_list_test.go cli: add acl token list command, documentation 2019-04-12 15:48:36 +00:00
acl_token_self.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
acl_token_self_test.go policy list and token self commands 2017-10-13 16:31:46 -07:00
acl_token_update.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
acl_token_update_test.go Rename TestAgent.Token to TestAgent.RootToken 2017-10-06 14:35:14 -07:00
agent_info.go Add autocomplete where missing 2018-05-11 18:05:43 -04:00
agent_info_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
alloc.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
alloc_fs.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
alloc_fs_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
alloc_logs.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
alloc_logs_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
alloc_restart.go allocs: Add nomad alloc restart 2019-04-11 14:25:49 +02:00
alloc_restart_test.go allocs: Add nomad alloc restart 2019-04-11 14:25:49 +02:00
alloc_status.go Add NodeName to the alloc/job status outputs. 2019-04-10 10:34:10 -05:00
alloc_status_test.go Remove redundant assertion and replace regex matches with require 2019-04-10 10:34:10 -05:00
alloc_stop.go allocs: Add nomad alloc stop 2019-04-23 12:50:23 +02:00
alloc_stop_test.go allocs: Add nomad alloc stop 2019-04-23 12:50:23 +02:00
check.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
check_test.go Parallel 2017-07-20 21:24:21 -07:00
commands.go Merge pull request #5512 from hashicorp/dani/f-alloc-stop 2019-04-23 13:05:08 +02:00
data_format.go Formatting abilities 2017-07-07 12:07:07 -07:00
data_format_test.go Parallel 2017-07-20 21:24:21 -07:00
deployment.go Fixed typo in deployment help text 2018-05-24 12:44:21 -04:00
deployment_fail.go Fix output of 'nomad deployment fail' with no arg 2018-12-13 13:22:17 -05:00
deployment_fail_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
deployment_list.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
deployment_list_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
deployment_pause.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
deployment_pause_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
deployment_promote.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
deployment_promote_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
deployment_resume.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
deployment_resume_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
deployment_status.go CLI 2018-05-07 14:50:01 -05:00
deployment_status_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
docker_logger_plugin.go Plugins use parent loggers 2019-01-11 11:36:37 -08:00
eval.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
eval_status.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
eval_status_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
executor_plugin.go fix crash when executor parent nomad process dies 2019-04-23 09:52:46 -04:00
helper_devices.go device attributes in nomad node status -verbose 2018-12-10 12:18:24 -05:00
helper_devices_test.go fixup! device attributes in nomad node status -verbose 2018-12-12 09:17:31 -05:00
helpers.go command: fix misspelling in comment 2018-04-18 12:19:53 -04:00
helpers_test.go fix flaky pretty time test 2018-04-03 18:15:12 -07:00
integration_test.go tests: stop integration tests tasks explicitly 2018-12-04 11:50:59 -05:00
job.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
job_deployments.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
job_deployments_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_dispatch.go command: fix job dispatch arg check 2018-04-18 21:21:43 -04:00
job_dispatch_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_eval.go remove extra return 2018-05-21 18:00:14 -05:00
job_eval_test.go unit test for job eval should detach 2018-05-10 15:30:44 -05:00
job_history.go spelling fix 2018-08-14 14:06:04 -04:00
job_history_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_init.go fix indentation 2019-02-14 12:49:26 -06:00
job_init_test.go nomad/command: fix strings.Contains args order 2019-02-02 09:43:24 +03:00
job_inspect.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
job_inspect_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_periodic.go gofmt/goimport and test formatting 2019-04-12 20:55:55 +00:00
job_periodic_force.go gofmt/goimport and test formatting 2019-04-12 20:55:55 +00:00
job_periodic_force_test.go gofmt/goimport and test formatting 2019-04-12 20:55:55 +00:00
job_plan.go review feedback 2018-11-08 09:48:43 -06:00
job_plan_test.go Fix vet error 2018-11-08 09:48:43 -06:00
job_promote.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
job_promote_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_revert.go "job revert" command: alphabetized flags 2019-04-10 10:34:10 -05:00
job_revert_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_run.go Fix command line 2018-04-26 15:46:22 -07:00
job_run_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_status.go Don't display node name if output isn't verbose. Add tests. 2019-04-10 10:34:10 -05:00
job_status_test.go Remove redundant assertion and replace regex matches with require 2019-04-10 10:34:10 -05:00
job_stop.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
job_stop_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
job_validate.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
job_validate_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
logmon_plugin.go Plugins use parent loggers 2019-01-11 11:36:37 -08:00
meta.go color 2018-03-21 20:27:32 -07:00
meta_test.go add acl token as meta flag 2017-09-15 23:33:43 +00:00
monitor.go Fix formatting of allocation score metrics 2018-10-30 12:03:23 -05:00
monitor_test.go spelling: triggered 2018-03-11 19:06:15 +00:00
namespace.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
namespace_apply.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
namespace_apply_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
namespace_delete.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
namespace_delete_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
namespace_inspect.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
namespace_inspect_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
namespace_list.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
namespace_list_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
namespace_status.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
namespace_status_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
node.go Fix typo in nomad node help text 2018-06-14 15:48:01 +02:00
node_config.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
node_config_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
node_drain.go drain: fix node drain monitoring 2019-01-08 09:35:16 -08:00
node_drain_test.go drain: fix node drain monitoring 2019-01-08 09:35:16 -08:00
node_eligibility.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
node_eligibility_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
node_status.go nil check node resources to prevent panic 2019-01-22 19:34:02 -06:00
node_status_test.go Prepare to reuse device resources printing 2018-11-16 10:26:32 -05:00
operator.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_autopilot.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_autopilot_get.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_autopilot_get_test.go Add autopilot functionality based on Consul's autopilot 2017-12-18 14:29:41 -08:00
operator_autopilot_set.go Fix autopilot set enable custom upgrades flag 2018-09-25 13:49:35 -07:00
operator_autopilot_set_test.go Fix autopilot set enable custom upgrades flag 2018-09-25 13:49:35 -07:00
operator_autopilot_test.go Add autopilot functionality based on Consul's autopilot 2017-12-18 14:29:41 -08:00
operator_keygen.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_keygen_test.go rename files 2018-03-21 20:27:32 -07:00
operator_keyring.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_raft.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_raft_list.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_raft_list_test.go Parallel 2017-07-20 21:24:21 -07:00
operator_raft_remove.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
operator_raft_remove_test.go Add raft remove by id endpoint/command 2018-01-16 13:35:32 -08:00
operator_raft_test.go Parallel 2017-07-20 21:24:21 -07:00
operator_test.go Parallel 2017-07-20 21:24:21 -07:00
quota.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
quota_apply.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
quota_apply_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
quota_delete.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
quota_delete_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
quota_init.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
quota_init_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
quota_inspect.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
quota_inspect_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
quota_list.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
quota_list_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
quota_status.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
quota_status_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
sentinel.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
sentinel_apply.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
sentinel_apply_test.go sync 2017-09-19 10:08:23 -05:00
sentinel_delete.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
sentinel_delete_test.go sync 2017-09-19 10:08:23 -05:00
sentinel_list.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
sentinel_list_test.go sync 2017-09-19 10:08:23 -05:00
sentinel_read.go command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
sentinel_read_test.go sync 2017-09-19 10:08:23 -05:00
server.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
server_force_leave.go Add autocomplete where missing 2018-05-11 18:05:43 -04:00
server_force_leave_test.go Parallel 2017-07-20 21:24:21 -07:00
server_join.go Add autocomplete where missing 2018-05-11 18:05:43 -04:00
server_join_test.go Parallel 2017-07-20 21:24:21 -07:00
server_members.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
server_members_test.go command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
status.go status: Allow passing -verbose to meta status 2019-04-11 13:15:44 +02:00
status_test.go Status honors exact match and displays matches when more than one is available 2017-08-29 08:42:09 -07:00
ui.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
util_test.go Standardize retrieving a free port into a helper package 2017-10-23 16:48:20 -07:00
version.go command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
version_test.go Parallel 2017-07-20 21:24:21 -07:00