{"action":"created","issue":{"url":"https://api.github.com/repos/bloomberg/phabricator-tools/issues/49","labels_url":"https://api.github.com/repos/bloomberg/phabricator-tools/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/bloomberg/phabricator-tools/issues/49/comments","events_url":"https://api.github.com/repos/bloomberg/phabricator-tools/issues/49/events","html_url":"https://github.com/bloomberg/phabricator-tools/pull/49","id":108684646,"number":49,"title":"Arcyd: Add reason for stopping to info logs","user":{"login":"cs-shadow","id":2458024,"avatar_url":"https://avatars.githubusercontent.com/u/2458024?v=3","gravatar_id":"","url":"https://api.github.com/users/cs-shadow","html_url":"https://github.com/cs-shadow","followers_url":"https://api.github.com/users/cs-shadow/followers","following_url":"https://api.github.com/users/cs-shadow/following{/other_user}","gists_url":"https://api.github.com/users/cs-shadow/gists{/gist_id}","starred_url":"https://api.github.com/users/cs-shadow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs-shadow/subscriptions","organizations_url":"https://api.github.com/users/cs-shadow/orgs","repos_url":"https://api.github.com/users/cs-shadow/repos","events_url":"https://api.github.com/users/cs-shadow/events{/privacy}","received_events_url":"https://api.github.com/users/cs-shadow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bloomberg/phabricator-tools/labels/for%20review","name":"for review","color":"e6e6e6"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-28T15:34:30Z","updated_at":"2015-09-29T07:44:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bloomberg/phabricator-tools/pulls/49","html_url":"https://github.com/bloomberg/phabricator-tools/pull/49","diff_url":"https://github.com/bloomberg/phabricator-tools/pull/49.diff","patch_url":"https://github.com/bloomberg/phabricator-tools/pull/49.patch"},"body":"When Arcyd stops gracefully, a log entry is left in /var/log/info. This\r\nis useful for knowing when Arcyd was stopped. It would be helpful to\r\nhave a reason in the log as well. This commit adds command line\r\nargument \"-m\"/\"--message\" to \"arcyd stop\" and \"arcyd restart\" commands\r\nto supply this reason.\r\n\r\nThis argument is optional but it is highly recommended to provide this\r\nargument whenever stopping or restarting Arcyd.\r\n\r\nTest plan:\r\n$ ./precommit.sh\r\n\r\nLaunch Arcyd test shell using ./testbed/arcyd/test_shell.sh. Now, stop\r\nArcyd using following command:\r\n  $ arcyd stop -m \"Stopped arcyd to ensure this message is logged\"\r\n\r\nNow ensure that /var/log/info contains an entry similar to the\r\nfollowing:\r\n  INFO: stopped arcyd\r\n  INFO: Reason for stopping Arcyd: Stopped arcyd to ensure this message is logged\r\n\r\nStart Arcyd again using following command:\r\n  $ arcyd start\r\n\r\nNow, restart Arcyd using following command:\r\n  $ arcyd restart -m \"Restarted arcyd to ensure this message is logged\"\r\n\r\nNow ensure that /var/log/info contains an entry similar to the\r\nfollowing:\r\n  INFO: stopped arcyd\r\n  INFO: Reason for stopping Arcyd: Restarted arcyd to ensure this message is logged\r\n  INFO: started arcyd\r\n\r\nFixes #39"},"comment":{"url":"https://api.github.com/repos/bloomberg/phabricator-tools/issues/comments/143975251","html_url":"https://github.com/bloomberg/phabricator-tools/pull/49#issuecomment-143975251","issue_url":"https://api.github.com/repos/bloomberg/phabricator-tools/issues/49","id":143975251,"user":{"login":"aevri","id":1478530,"avatar_url":"https://avatars.githubusercontent.com/u/1478530?v=3","gravatar_id":"","url":"https://api.github.com/users/aevri","html_url":"https://github.com/aevri","followers_url":"https://api.github.com/users/aevri/followers","following_url":"https://api.github.com/users/aevri/following{/other_user}","gists_url":"https://api.github.com/users/aevri/gists{/gist_id}","starred_url":"https://api.github.com/users/aevri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aevri/subscriptions","organizations_url":"https://api.github.com/users/aevri/orgs","repos_url":"https://api.github.com/users/aevri/repos","events_url":"https://api.github.com/users/aevri/events{/privacy}","received_events_url":"https://api.github.com/users/aevri/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T07:44:02Z","updated_at":"2015-09-29T07:44:02Z","body":"After reading the patch, I now realise I should have recommended a different approach to logging the reason. Sorry :)\r\n\r\nAlthough we wait until after Arcyd has stopped to put the reason for stopping in the logs, we are still potentially racing against another contender to write to the log files.\r\n\r\nAlso, if the user `ctrl-c`'s after the kill file is written then the reason will not be written to the logs.\r\n\r\nAn alternate approach we could take is to write the reason into the kill file, and have the running arcyd instance do the logging instead. That should address the above concerns.\r\n\r\nPlease could you address those concerns by writing into the kill file or another approach?"}}