)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4ef6510360e9d1776b0fde6906404671effd84a7","unresolved":false,"context_lines":[{"line_number":15,"context_line":"zombie process accumulation on long running deployments."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I48a665b089bf2d09eec9909e300a64f6e15cbdfe"},{"line_number":18,"context_line":"Resolves-Bug: #1854134"},{"line_number":19,"context_line":"Signed-off-by: Yash Gupta \u003cy.gupta@samsung.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3fa7e38b_5f94c536","line":18,"range":{"start_line":18,"start_character":0,"end_line":18,"end_character":22},"updated":"2019-11-27 12:30:33.000000000","message":"It should be:\n\n Closes-Bug: 1854134\n\nOtherwise launchpad will not catch it.","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"}],"kuryr_kubernetes/cni/daemon/service.py":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4ef6510360e9d1776b0fde6906404671effd84a7","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        super(CNIDaemonServiceManager, self).run()"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def _zombie_reaper(self):"},{"line_number":310,"context_line":"        while True:"},{"line_number":311,"context_line":"            try:"},{"line_number":312,"context_line":"                res \u003d os.waitpid(-1, os.WNOHANG)"},{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_905eaa4f","line":310,"range":{"start_line":310,"start_character":0,"end_line":310,"end_character":19},"updated":"2019-11-27 12:30:33.000000000","message":"I understand this is a daemon process, so we may ignore that, but maybe let\u0027s make sure this finishes when terminate() is called? I don\u0027t have strong opinion on that, I\u0027m not a Linux wizard, so open to discussion.","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"76753d16a74d2744fe9ebe3e9f0d3fc0f16e0082","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        super(CNIDaemonServiceManager, self).run()"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def _zombie_reaper(self):"},{"line_number":310,"context_line":"        while True:"},{"line_number":311,"context_line":"            try:"},{"line_number":312,"context_line":"                res \u003d os.waitpid(-1, os.WNOHANG)"},{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_22967ef1","line":310,"range":{"start_line":310,"start_character":0,"end_line":310,"end_character":19},"in_reply_to":"3fa7e38b_6eff8735","updated":"2019-11-28 11:06:55.000000000","message":"I\u0027d still leave the daemon flag.","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":28082,"name":"Yash Gupta","email":"y.gupta@samsung.com","username":"y.gupta"},"change_message_id":"12c92157c4d7074e7e6f11812f840b666ec7eb5b","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        super(CNIDaemonServiceManager, self).run()"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def _zombie_reaper(self):"},{"line_number":310,"context_line":"        while True:"},{"line_number":311,"context_line":"            try:"},{"line_number":312,"context_line":"                res \u003d os.waitpid(-1, os.WNOHANG)"},{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_6eff8735","line":310,"range":{"start_line":310,"start_character":0,"end_line":310,"end_character":19},"in_reply_to":"3fa7e38b_905eaa4f","updated":"2019-11-28 02:24:52.000000000","message":"Yes, we can add some signalling mechanism using shared variables, I\u0027m not sure if we should remove the daemon flag in that case.","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4ef6510360e9d1776b0fde6906404671effd84a7","unresolved":false,"context_lines":[{"line_number":309,"context_line":"    def _zombie_reaper(self):"},{"line_number":310,"context_line":"        while True:"},{"line_number":311,"context_line":"            try:"},{"line_number":312,"context_line":"                res \u003d os.waitpid(-1, os.WNOHANG)"},{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"},{"line_number":314,"context_line":"                if res \u003d\u003d (0, 0):"},{"line_number":315,"context_line":"                    time.sleep(1)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_b095e6e5","line":312,"range":{"start_line":312,"start_character":0,"end_line":312,"end_character":48},"updated":"2019-11-27 12:30:33.000000000","message":"How about using just multiprocessing.active_children()? Apparently its side effect is exactly what we want here [1].\n\n[1] https://docs.python.org/3.8/library/multiprocessing.html#multiprocessing.active_children","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"76753d16a74d2744fe9ebe3e9f0d3fc0f16e0082","unresolved":false,"context_lines":[{"line_number":309,"context_line":"    def _zombie_reaper(self):"},{"line_number":310,"context_line":"        while True:"},{"line_number":311,"context_line":"            try:"},{"line_number":312,"context_line":"                res \u003d os.waitpid(-1, os.WNOHANG)"},{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"},{"line_number":314,"context_line":"                if res \u003d\u003d (0, 0):"},{"line_number":315,"context_line":"                    time.sleep(1)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_7dc73748","line":312,"range":{"start_line":312,"start_character":0,"end_line":312,"end_character":48},"in_reply_to":"3fa7e38b_8ec9a352","updated":"2019-11-28 11:06:55.000000000","message":"Yeaaah, \"Explicit is better than implicit.\", so let\u0027s stick to this.","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":28082,"name":"Yash Gupta","email":"y.gupta@samsung.com","username":"y.gupta"},"change_message_id":"12c92157c4d7074e7e6f11812f840b666ec7eb5b","unresolved":false,"context_lines":[{"line_number":309,"context_line":"    def _zombie_reaper(self):"},{"line_number":310,"context_line":"        while True:"},{"line_number":311,"context_line":"            try:"},{"line_number":312,"context_line":"                res \u003d os.waitpid(-1, os.WNOHANG)"},{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"},{"line_number":314,"context_line":"                if res \u003d\u003d (0, 0):"},{"line_number":315,"context_line":"                    time.sleep(1)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_8ec9a352","line":312,"range":{"start_line":312,"start_character":0,"end_line":312,"end_character":48},"in_reply_to":"3fa7e38b_b095e6e5","updated":"2019-11-28 02:24:52.000000000","message":"While the side effect is what we want, I\u0027m not sure if it might have any effect on performance  (as it lists all child running processes too). \n\nAlso, how do you suggest to determine if any zombies were found (so we can sleep or not, depending on it)?","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4ef6510360e9d1776b0fde6906404671effd84a7","unresolved":false,"context_lines":[{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"},{"line_number":314,"context_line":"                if res \u003d\u003d (0, 0):"},{"line_number":315,"context_line":"                    time.sleep(1)"},{"line_number":316,"context_line":"            except os.ChildProcessError:"},{"line_number":317,"context_line":"                # There are no child processes yet (or they have been killed)"},{"line_number":318,"context_line":"                time.sleep(1)"},{"line_number":319,"context_line":"            except os.error:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_f0dcbee2","line":316,"range":{"start_line":316,"start_character":22,"end_line":316,"end_character":39},"updated":"2019-11-27 12:30:33.000000000","message":"That seems to be a builtin exception [1]? I don\u0027t see it in the docs of waitpid [2].\n\n[1] https://docs.python.org/3/library/exceptions.html#ChildProcessError\n[2] https://docs.python.org/3.8/library/os.html#os.waitpid","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":28082,"name":"Yash Gupta","email":"y.gupta@samsung.com","username":"y.gupta"},"change_message_id":"12c92157c4d7074e7e6f11812f840b666ec7eb5b","unresolved":false,"context_lines":[{"line_number":313,"context_line":"                # sleep for some time if no zombie process was found"},{"line_number":314,"context_line":"                if res \u003d\u003d (0, 0):"},{"line_number":315,"context_line":"                    time.sleep(1)"},{"line_number":316,"context_line":"            except os.ChildProcessError:"},{"line_number":317,"context_line":"                # There are no child processes yet (or they have been killed)"},{"line_number":318,"context_line":"                time.sleep(1)"},{"line_number":319,"context_line":"            except os.error:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_ce355b47","line":316,"range":{"start_line":316,"start_character":22,"end_line":316,"end_character":39},"in_reply_to":"3fa7e38b_f0dcbee2","updated":"2019-11-28 02:24:52.000000000","message":"[3] says errorno is set to ECHILD when calling process does not have any unwaited-for children. \n\n[2] says \"An OSError is raised with the value of errno when the syscall returns -1.\", and [1] says this is the exception when errorno is ECHILD. So it seemed okay to use.\n\n[3] https://linux.die.net/man/2/waitpid","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4ef6510360e9d1776b0fde6906404671effd84a7","unresolved":false,"context_lines":[{"line_number":316,"context_line":"            except os.ChildProcessError:"},{"line_number":317,"context_line":"                # There are no child processes yet (or they have been killed)"},{"line_number":318,"context_line":"                time.sleep(1)"},{"line_number":319,"context_line":"            except os.error:"},{"line_number":320,"context_line":"                LOG.exception(\"Got OS error while reaping zombie processes\")"},{"line_number":321,"context_line":""},{"line_number":322,"context_line":"    def terminate(self):"},{"line_number":323,"context_line":"        self.manager.shutdown()"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_b0f08668","line":320,"range":{"start_line":319,"start_character":0,"end_line":320,"end_character":76},"updated":"2019-11-27 12:30:33.000000000","message":"This should wait as well.","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":28082,"name":"Yash Gupta","email":"y.gupta@samsung.com","username":"y.gupta"},"change_message_id":"12c92157c4d7074e7e6f11812f840b666ec7eb5b","unresolved":false,"context_lines":[{"line_number":316,"context_line":"            except os.ChildProcessError:"},{"line_number":317,"context_line":"                # There are no child processes yet (or they have been killed)"},{"line_number":318,"context_line":"                time.sleep(1)"},{"line_number":319,"context_line":"            except os.error:"},{"line_number":320,"context_line":"                LOG.exception(\"Got OS error while reaping zombie processes\")"},{"line_number":321,"context_line":""},{"line_number":322,"context_line":"    def terminate(self):"},{"line_number":323,"context_line":"        self.manager.shutdown()"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_4e416ba6","line":320,"range":{"start_line":319,"start_character":0,"end_line":320,"end_character":76},"in_reply_to":"3fa7e38b_b0f08668","updated":"2019-11-28 02:24:52.000000000","message":"Yes, good idea, this exception might be due to some race condition.","commit_id":"e85aea3bb7da8d9c3a704420cbd3c60ee4ed516e"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"76753d16a74d2744fe9ebe3e9f0d3fc0f16e0082","unresolved":false,"context_lines":[{"line_number":315,"context_line":"                # as there could be more"},{"line_number":316,"context_line":"                if res !\u003d (0, 0):"},{"line_number":317,"context_line":"                    continue"},{"line_number":318,"context_line":"            except os.ChildProcessError:"},{"line_number":319,"context_line":"                # There are no child processes yet (or they have been killed)"},{"line_number":320,"context_line":"                pass"},{"line_number":321,"context_line":"            except os.error:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_3dd69ff4","line":318,"range":{"start_line":318,"start_character":19,"end_line":318,"end_character":39},"updated":"2019-11-28 11:06:55.000000000","message":"I\u0027d still argue this exception does not exist:\n\n mdulko:~/ $ python2 -c \"import os; os.ChildProcessError\"\n Traceback (most recent call last):\n   File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\n AttributeError: \u0027module\u0027 object has no attribute \u0027ChildProcessError\u0027\n mdulko:~/ $ python3 -c \"import os; os.ChildProcessError\"\n Traceback (most recent call last):\n   File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\n AttributeError: module \u0027os\u0027 has no attribute \u0027ChildProcessError\u0027\n\nOn the other hand it seems to be the correct exception to catch, but it\u0027s a builtin.\n\n \u003e\u003e\u003e issubclass(ChildProcessError, OSError)                                                      \n True","commit_id":"81d7ffbb07239806aa8ec2d26e4a813ee2a519b1"},{"author":{"_account_id":28082,"name":"Yash Gupta","email":"y.gupta@samsung.com","username":"y.gupta"},"change_message_id":"3758ce7a71d32fd64e3f8383e7c62f525b671ac1","unresolved":false,"context_lines":[{"line_number":315,"context_line":"                # as there could be more"},{"line_number":316,"context_line":"                if res !\u003d (0, 0):"},{"line_number":317,"context_line":"                    continue"},{"line_number":318,"context_line":"            except os.ChildProcessError:"},{"line_number":319,"context_line":"                # There are no child processes yet (or they have been killed)"},{"line_number":320,"context_line":"                pass"},{"line_number":321,"context_line":"            except os.error:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_c0aaf8d1","line":318,"range":{"start_line":318,"start_character":19,"end_line":318,"end_character":39},"in_reply_to":"3fa7e38b_3dd69ff4","updated":"2019-11-29 06:34:39.000000000","message":"My bad, somehow didn\u0027t notice this earlier. Fixed","commit_id":"81d7ffbb07239806aa8ec2d26e4a813ee2a519b1"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"95c5444cd24cb5ba0af8339e55bd8d0f5bcde226","unresolved":false,"context_lines":[{"line_number":318,"context_line":"            except ChildProcessError:"},{"line_number":319,"context_line":"                # There are no child processes yet (or they have been killed)"},{"line_number":320,"context_line":"                pass"},{"line_number":321,"context_line":"            except os.error:"},{"line_number":322,"context_line":"                LOG.exception(\"Got OS error while reaping zombie processes\")"},{"line_number":323,"context_line":"            if self._terminate_called.isSet():"},{"line_number":324,"context_line":"                break"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_544ec66e","line":321,"range":{"start_line":321,"start_character":19,"end_line":321,"end_character":27},"updated":"2019-12-02 11:57:02.000000000","message":"I just realized this can be just OSError, but it\u0027s not so important.","commit_id":"630217fbe72c62b259281a55db97e43343b84956"}]}
