{"action":"created","issue":{"url":"https://api.github.com/repos/agronholm/pythonfutures/issues/29","labels_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/29/comments","events_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/29/events","html_url":"https://github.com/agronholm/pythonfutures/issues/29","id":61388144,"number":29,"title":"Child process termination not known by Parent error in concurrent.futures","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/agronholm/pythonfutures/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/agronholm/pythonfutures/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/agronholm/pythonfutures/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/agronholm/pythonfutures/labels/Type-Defect","name":"Type-Defect","color":"ededed"},{"url":"https://api.github.com/repos/agronholm/pythonfutures/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-14T03:43:42Z","updated_at":"2015-05-03T06:23:08Z","closed_at":"2015-05-03T06:23:08Z","body":"```\nWhat steps will reproduce the problem?\n\n1. Submit a task using ProcessPoolExecutor\n2. kill -9 <one_of_childrens_pid>\n3. parent process gets blocked forever.\n\nWhat is the expected output? What do you see instead?\n\nWe encountered an error in which if a child process dies or crashes the parent \nprocess is not notified and parent goes in blocked state. Other children are \neither in blocked or timed out state.\n\nWe were able to reproduce this scenario by using following code and by killing \none of the child.\n\n#!/home/y/bin64/python2.7\n\nimport concurrent.futures\nimport time\nimport signal\nimport os\nimport sys\nimport traceback\n\n\ndef just_wait(identifier):\n    time.sleep(20)\n    return identifier\n\ndef signal_handler(sig, stack):\n    try:\n        result = os.waitpid(-1, os.WNOHANG)\n        while result[0]:\n            print(\"Reaped child process %s\" % result[0])\n            result = os.waitpid(-1, os.WNOHANG)\n        traceback.print_stack()\n        sys.exit()    \n    except (OSError):\n        pass\n\ndef main():\n    with concurrent.futures.ProcessPoolExecutor(max_workers=30) as executor:\n        future_to_id = [executor.submit(just_wait, i) for i in range(1, 31)]\n        for future in concurrent.futures.as_completed(future_to_id):\n            returned_id = future.result()\n            print \"Process Id: \", returned_id\n    \nif __name__=='__main__':\n    signal.signal(signal.SIGCHLD, signal_handler)\n    main()\n\nThe status of one of the child processes:\n$sudo strace -p 30974\nPassword: \nProcess 30974 attached - interrupt to quit\nrestart_syscall(<... resuming interrupted call ...>) = -1 ETIMEDOUT (Connection \ntimed out)\ngettimeofday({1410964539, 104107}, NULL) = 0\ngettimeofday({1410964539, 104165}, NULL) = 0\nfutex(0x7f3e698e7000, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 0, {1410964539, \n204165000}, ffffffff) = -1 ETIMEDOUT (Connection timed out)\ngettimeofday({1410964539, 204812}, NULL) = 0\ngettimeofday({1410964539, 204845}, NULL) = 0\n\nThe status for parent process:\nsudo strace -p 30948\nProcess 30948 attached - interrupt to quit\nfutex(0x1addc30, FUTEX_WAIT_PRIVATE, 0, NULL\n\nWhat version of the product are you using? On what operating system?\nRHEL - 6.4.\n\nPlease provide any additional information below.\nHere's the related issue that got fixed in python 3.3 - \nhttp://bugs.python.org/issue9205\nSince we are using python 2.7.5, is this possible to backport this fix as well \nto futures for 2.7.5.\n\n```\n\nOriginal issue reported on code.google.com by `immil...@yahoo-inc.com` on 17 Sep 2014 at 9:25"},"comment":{"url":"https://api.github.com/repos/agronholm/pythonfutures/issues/comments/98441440","html_url":"https://github.com/agronholm/pythonfutures/issues/29#issuecomment-98441440","issue_url":"https://api.github.com/repos/agronholm/pythonfutures/issues/29","id":98441440,"user":{"login":"agronholm","id":130003,"avatar_url":"https://avatars.githubusercontent.com/u/130003?v=3","gravatar_id":"","url":"https://api.github.com/users/agronholm","html_url":"https://github.com/agronholm","followers_url":"https://api.github.com/users/agronholm/followers","following_url":"https://api.github.com/users/agronholm/following{/other_user}","gists_url":"https://api.github.com/users/agronholm/gists{/gist_id}","starred_url":"https://api.github.com/users/agronholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agronholm/subscriptions","organizations_url":"https://api.github.com/users/agronholm/orgs","repos_url":"https://api.github.com/users/agronholm/repos","events_url":"https://api.github.com/users/agronholm/events{/privacy}","received_events_url":"https://api.github.com/users/agronholm/received_events","type":"User","site_admin":false},"created_at":"2015-05-03T06:23:08Z","updated_at":"2015-05-03T06:23:08Z","body":"The relevant fix upstream uses Python 3 features and cannot be backported. If you have a suggestion, I'm all ears."}}