{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/WALinuxAgent/issues/272","repository_url":"https://api.github.com/repos/Azure/WALinuxAgent","labels_url":"https://api.github.com/repos/Azure/WALinuxAgent/issues/272/labels{/name}","comments_url":"https://api.github.com/repos/Azure/WALinuxAgent/issues/272/comments","events_url":"https://api.github.com/repos/Azure/WALinuxAgent/issues/272/events","html_url":"https://github.com/Azure/WALinuxAgent/issues/272","id":162759476,"number":272,"title":"Children process is leaked","user":{"login":"ahmetalpbalkan","id":159209,"avatar_url":"https://avatars.githubusercontent.com/u/159209?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmetalpbalkan","html_url":"https://github.com/ahmetalpbalkan","followers_url":"https://api.github.com/users/ahmetalpbalkan/followers","following_url":"https://api.github.com/users/ahmetalpbalkan/following{/other_user}","gists_url":"https://api.github.com/users/ahmetalpbalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmetalpbalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmetalpbalkan/subscriptions","organizations_url":"https://api.github.com/users/ahmetalpbalkan/orgs","repos_url":"https://api.github.com/users/ahmetalpbalkan/repos","events_url":"https://api.github.com/users/ahmetalpbalkan/events{/privacy}","received_events_url":"https://api.github.com/users/ahmetalpbalkan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/WALinuxAgent/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-28T18:53:52Z","updated_at":"2016-06-28T19:09:36Z","closed_at":null,"body":"(CentOS 6.5 with the develop branch of the agent but I'm not sure if the problem is limited to CentOS)\r\n\r\nIt appears like when the waagent service is stopped (`service waagent stop`) we're leaking the extension handler child process. Likely a signal forwarding issue.\r\n\r\n> Sitenote: it also appears like I can run multiple `-daemon`s manually as well, what happened to our pidfile checking?\r\n\r\nHere's pstree output from commands:\r\n\r\n### service waagent start\r\n\r\n```\r\n  ├─python,30086 /usr/sbin/waagent -daemon\r\n  │   ├─python,30108 /usr/sbin/waagent run-exthandlers\r\n  │   ├─{python},30104\r\n  │   └─{python},30106\r\n```\r\n\r\n### service waagent stop\r\n\r\n> child process gets parented to init\r\n\r\n```\r\n$ pstree -a -p\r\ninit,1\r\n  ...\r\n  ├─python,30108 /usr/sbin/waagent run-exthandlers\r\n  ...\r\n```\r\n\r\n### service waagent start\r\n\r\ntwo instances of `run-exthandlers`\r\n\r\n```\r\ninit,1\r\n  ...\r\n  ├─python,30108 /usr/sbin/waagent run-exthandlers\r\n  ├─python,30159 /usr/sbin/waagent -daemon\r\n  │   ├─python,30182 /usr/sbin/waagent run-exthandlers\r\n  │   ├─{python},30178\r\n  │   └─{python},30180\r\n```\r\n\r\n### service waagent stop\r\n\r\nAnother run-exthandlers parented to init.\r\n\r\n```\r\ninit,1\r\n  ...\r\n  ├─portreserve,1297\r\n  ├─python,30108 /usr/sbin/waagent run-exthandlers\r\n  ├─python,30182 /usr/sbin/waagent run-exthandlers\r\n  ├─rpc.statd,1365\r\n```\r\n\r\n### service waagent start\r\n\r\n```\r\ninit,1\r\n  ...\r\n  ├─python,30108 /usr/sbin/waagent run-exthandlers\r\n  ├─python,30182 /usr/sbin/waagent run-exthandlers\r\n  ├─python,30213 /usr/sbin/waagent -daemon\r\n  │   ├─python,30234 /usr/sbin/waagent run-exthandlers\r\n  │   ├─{python},30230\r\n  │   └─{python},30232\r\n```\r\n\r\n### service waagent stop\r\n\r\n```\r\ninit,1\r\n  ...\r\n  ├─portreserve,1297\r\n  ├─python,30108 /usr/sbin/waagent run-exthandlers\r\n  ├─python,30182 /usr/sbin/waagent run-exthandlers\r\n  ├─python,30234 /usr/sbin/waagent run-exthandlers\r\n  ├─rpc.statd,1365\r\n```\r\n\r\nso this can keep going on..."},"comment":{"url":"https://api.github.com/repos/Azure/WALinuxAgent/issues/comments/229151199","html_url":"https://github.com/Azure/WALinuxAgent/issues/272#issuecomment-229151199","issue_url":"https://api.github.com/repos/Azure/WALinuxAgent/issues/272","id":229151199,"user":{"login":"ahmetalpbalkan","id":159209,"avatar_url":"https://avatars.githubusercontent.com/u/159209?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmetalpbalkan","html_url":"https://github.com/ahmetalpbalkan","followers_url":"https://api.github.com/users/ahmetalpbalkan/followers","following_url":"https://api.github.com/users/ahmetalpbalkan/following{/other_user}","gists_url":"https://api.github.com/users/ahmetalpbalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmetalpbalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmetalpbalkan/subscriptions","organizations_url":"https://api.github.com/users/ahmetalpbalkan/orgs","repos_url":"https://api.github.com/users/ahmetalpbalkan/repos","events_url":"https://api.github.com/users/ahmetalpbalkan/events{/privacy}","received_events_url":"https://api.github.com/users/ahmetalpbalkan/received_events","type":"User","site_admin":false},"created_at":"2016-06-28T19:09:36Z","updated_at":"2016-06-28T19:09:36Z","body":"> Hmm, DaemonHandler#main still checks for the pidfile.\r\n\r\nI can run just two `/usr/sbin/waagent -daemon`s in separate shells just fine on the same machine, that's why I thought the pidfile thing is not working.\r\n\r\n> I was under the impression that killing the parent process would terminate the child??\r\n\r\nme too, hence the issue. Python subprocess.Popen probably has some weird thing going on. I tried sending SIGTERM and SIGSEGV to parent process, in both cases the child got re-parented to init and just continued to run..."}}
{"actor":{"display_login":"ahmetalpbalkan"}}