{"action":"created","issue":{"url":"https://api.github.com/repos/python/cpython/issues/7850","repository_url":"https://api.github.com/repos/python/cpython","labels_url":"https://api.github.com/repos/python/cpython/issues/7850/labels{/name}","comments_url":"https://api.github.com/repos/python/cpython/issues/7850/comments","events_url":"https://api.github.com/repos/python/cpython/issues/7850/events","html_url":"https://github.com/python/cpython/pull/7850","id":334667927,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NTgzNDky","number":7850,"title":"bpo-33613, test_semaphore_tracker_sigint: fix race condition","user":{"login":"pablogsal","id":11718525,"node_id":"MDQ6VXNlcjExNzE4NTI1","avatar_url":"https://avatars0.githubusercontent.com/u/11718525?v=4","gravatar_id":"","url":"https://api.github.com/users/pablogsal","html_url":"https://github.com/pablogsal","followers_url":"https://api.github.com/users/pablogsal/followers","following_url":"https://api.github.com/users/pablogsal/following{/other_user}","gists_url":"https://api.github.com/users/pablogsal/gists{/gist_id}","starred_url":"https://api.github.com/users/pablogsal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablogsal/subscriptions","organizations_url":"https://api.github.com/users/pablogsal/orgs","repos_url":"https://api.github.com/users/pablogsal/repos","events_url":"https://api.github.com/users/pablogsal/events{/privacy}","received_events_url":"https://api.github.com/users/pablogsal/received_events","type":"User","site_admin":false},"labels":[{"id":536945472,"node_id":"MDU6TGFiZWw1MzY5NDU0NzI=","url":"https://api.github.com/repos/python/cpython/labels/CLA%20signed","name":"CLA signed","color":"0e8a16","default":false},{"id":666980059,"node_id":"MDU6TGFiZWw2NjY5ODAwNTk=","url":"https://api.github.com/repos/python/cpython/labels/awaiting%20merge","name":"awaiting merge","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2018-06-21T21:40:14Z","updated_at":"2018-09-03T20:49:57Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/python/cpython/pulls/7850","html_url":"https://github.com/python/cpython/pull/7850","diff_url":"https://github.com/python/cpython/pull/7850.diff","patch_url":"https://github.com/python/cpython/pull/7850.patch"},"body":"Fail `test_semaphore_tracker_sigint` if no warnings are expected and\r\none is received.\r\n\r\nFix race condition when the child receives SIGINT\r\nbefore it can register signal handlers for it.\r\n\r\nThe race condition occurs when the parent calls\r\n`_semaphore_tracker.ensure_running()` (which in turn spawns the\r\nsemaphore_tracker using `_posixsubprocess.fork_exec`), the child\r\nregisters the signal handlers and the parent tries to kill the child.\r\nWhat seems to happen is that in some slow systems, the parent sends the\r\nsignal to kill the child before the child protects against the signal.\r\n\r\nThere is no reliable and portable solution for the parent to wait until\r\nthe child has register the signal handlers to send the signal to kill\r\nthe child so a `sleep` is introduced between the spawning of the child\r\nand the parent sending the signal to give time to the child to register\r\nthe handlers.\n\n<!-- issue-number: bpo-33613 -->\nhttps://bugs.python.org/issue33613\n<!-- /issue-number -->\n"},"comment":{"url":"https://api.github.com/repos/python/cpython/issues/comments/418191148","html_url":"https://github.com/python/cpython/pull/7850#issuecomment-418191148","issue_url":"https://api.github.com/repos/python/cpython/issues/7850","id":418191148,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODE5MTE0OA==","user":{"login":"vstinner","id":194129,"node_id":"MDQ6VXNlcjE5NDEyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/194129?v=4","gravatar_id":"","url":"https://api.github.com/users/vstinner","html_url":"https://github.com/vstinner","followers_url":"https://api.github.com/users/vstinner/followers","following_url":"https://api.github.com/users/vstinner/following{/other_user}","gists_url":"https://api.github.com/users/vstinner/gists{/gist_id}","starred_url":"https://api.github.com/users/vstinner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstinner/subscriptions","organizations_url":"https://api.github.com/users/vstinner/orgs","repos_url":"https://api.github.com/users/vstinner/repos","events_url":"https://api.github.com/users/vstinner/events{/privacy}","received_events_url":"https://api.github.com/users/vstinner/received_events","type":"User","site_admin":false},"created_at":"2018-09-03T20:49:57Z","updated_at":"2018-09-03T20:49:57Z","author_association":"MEMBER","body":"@pitrou wrote: \"I'm a bit uneasy with this. What if spawnv_passfds takes a very long time for some reason? The user will try to stop it using ^C... and nothing will happen.\"\r\n\r\nYou are true that SIGINT is blocked while spawnv_passfds() is running, but spawnv_passfds() should be quick in the parent: to oversimplify, it just calls fork() which should be very quick (it's not a O(n) operating thanks to copy-on-write). I prefer to see this race condition fixed. IMHO the short time window where CTRL+c is blocked is small enough to be acceptable.\r\n\r\nNote: signals are not lost or ignored, it's just that signals are only handled once spawnv_passfds() completes (once the signals are unblocked).\r\n\r\nI suggest to backport the change to 2.7, 3.6 and 3.7 branches to make our buildbots more reliable."}}
{"actor":{"display_login":"vstinner"}}