{"action":"opened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/27934","labels_url":"https://api.github.com/repos/saltstack/salt/issues/27934/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/27934/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/27934/events","html_url":"https://github.com/saltstack/salt/issues/27934","id":111354963,"number":27934,"title":"Master EventReturn process doesn't exit on SIGINT","user":{"login":"DmitryKuzmenko","id":4807387,"avatar_url":"https://avatars.githubusercontent.com/u/4807387?v=3","gravatar_id":"","url":"https://api.github.com/users/DmitryKuzmenko","html_url":"https://github.com/DmitryKuzmenko","followers_url":"https://api.github.com/users/DmitryKuzmenko/followers","following_url":"https://api.github.com/users/DmitryKuzmenko/following{/other_user}","gists_url":"https://api.github.com/users/DmitryKuzmenko/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitryKuzmenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitryKuzmenko/subscriptions","organizations_url":"https://api.github.com/users/DmitryKuzmenko/orgs","repos_url":"https://api.github.com/users/DmitryKuzmenko/repos","events_url":"https://api.github.com/users/DmitryKuzmenko/events{/privacy}","received_events_url":"https://api.github.com/users/DmitryKuzmenko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Confirmed","name":"Confirmed","color":"c7def8"}],"state":"open","locked":false,"assignee":{"login":"DmitryKuzmenko","id":4807387,"avatar_url":"https://avatars.githubusercontent.com/u/4807387?v=3","gravatar_id":"","url":"https://api.github.com/users/DmitryKuzmenko","html_url":"https://github.com/DmitryKuzmenko","followers_url":"https://api.github.com/users/DmitryKuzmenko/followers","following_url":"https://api.github.com/users/DmitryKuzmenko/following{/other_user}","gists_url":"https://api.github.com/users/DmitryKuzmenko/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitryKuzmenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitryKuzmenko/subscriptions","organizations_url":"https://api.github.com/users/DmitryKuzmenko/orgs","repos_url":"https://api.github.com/users/DmitryKuzmenko/repos","events_url":"https://api.github.com/users/DmitryKuzmenko/events{/privacy}","received_events_url":"https://api.github.com/users/DmitryKuzmenko/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/67","html_url":"https://github.com/saltstack/salt/milestones/B%2010","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/67/labels","id":1332026,"number":67,"title":"B 10","description":"","creator":{"login":"meggiebot","id":12242451,"avatar_url":"https://avatars.githubusercontent.com/u/12242451?v=3","gravatar_id":"","url":"https://api.github.com/users/meggiebot","html_url":"https://github.com/meggiebot","followers_url":"https://api.github.com/users/meggiebot/followers","following_url":"https://api.github.com/users/meggiebot/following{/other_user}","gists_url":"https://api.github.com/users/meggiebot/gists{/gist_id}","starred_url":"https://api.github.com/users/meggiebot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meggiebot/subscriptions","organizations_url":"https://api.github.com/users/meggiebot/orgs","repos_url":"https://api.github.com/users/meggiebot/repos","events_url":"https://api.github.com/users/meggiebot/events{/privacy}","received_events_url":"https://api.github.com/users/meggiebot/received_events","type":"User","site_admin":false},"open_issues":26,"closed_issues":1,"state":"open","created_at":"2015-09-30T20:33:22Z","updated_at":"2015-10-14T09:06:25Z","due_on":"2015-10-27T06:00:00Z","closed_at":null},"comments":0,"created_at":"2015-10-14T09:06:25Z","updated_at":"2015-10-14T09:06:25Z","closed_at":null,"body":"Reproduction steps:\r\n1. Run salt-master in foreground: salt-master -l debug\r\n2. Wait some time to let it start\r\n3. Press Ctrl-C\r\n\r\nResult:\r\n1. Master doesn't release the terminal. Terminal output is the following:\r\n```\r\n^C[DEBUG   ] Gathering reactors for tag salt/event/exit\r\n[WARNING ] Stopping the Salt Master\r\n[WARNING ] Exiting on Ctrl-c\r\n[INFO    ] The salt master is shut down\r\n[DEBUG   ] Stopping the multiprocessing logging queue listener\r\n[DEBUG   ] Stopped the multiprocessing logging queue listener\r\n```\r\n2. Two master processes still alive: process manager that just waits all processes exit and event return that hangs\r\n```\r\n$ ps aux | grep salt-master\r\ndimm      3084  0.1  0.5 307268 41140 pts/2    S+   11:19   0:00 python ./scripts/salt-master -l debug ProcessManager\r\ndimm      3159  0.0  0.4 389380 34896 pts/2    Sl+  11:19   0:00 python ./scripts/salt-master -l debug EventReturn\r\n```\r\n\r\nAnalyze:\r\nActually the EventReturn main loop handles KeyboardInterrupt exception on a proper way. But most of the time EventReturn spend in poll that is called by SaltEvent._get_event() that already catches KeyboardInterrupt and returns a special event with tag 'salt/event/exit' instead of raising exception.\r\n\r\nSo the proper way to handle keyboard interrupt would be not the only catch the exception but also handle the exit event."}}