Title: gh-157184: Scale the join() alarm in the multiprocessing kill tests by iamsharduld · Pull Request #157185 · python/cpython · GitHub
Open Graph Title: gh-157184: Scale the join() alarm in the multiprocessing kill tests by iamsharduld · Pull Request #157185 · python/cpython
X Title: gh-157184: Scale the join() alarm in the multiprocessing kill tests by iamsharduld · Pull Request #157185 · python/cpython
Description: _kill_process() guards the join() of the killed child with a SIGALRM so that a blocked waitpid() becomes a readable error instead of a hang. The alarm has been a literal 10 seconds since it was added in 2013 (cc5c728), so on a build slow enough that reaping the child legitimately takes longer than that, it fires on a healthy run and fails the test. That is what happened on the UBSan job of 57594aa (traceback in the issue): the alarm interrupted os.waitpid() itself. test.support.LONG_TIMEOUT is documented for this exact purpose, "Timeout in seconds to detect when a test hangs [...] It should not be used to mark a test as failed if the test takes 'too long'", and regrtest scales it from --timeout for slow workers. The SHORT_TIMEOUT docs point the same way: "If a test using SHORT_TIMEOUT starts to fail randomly on slow buildbots, use LONG_TIMEOUT instead." _kill_process() already uses support.SHORT_TIMEOUT a few lines above for its event wait. math.ceil() keeps the alarm from being cancelled outright if a very short --timeout scales the value below one second. Four tests go through this helper, in every start-method variant: test_interrupt, test_interrupt_no_handler, test_terminate and test_kill. Verified by making the child slow to die (a SIGINT handler that sleeps 12 seconds), which is what a loaded machine looks like from the parent's side, and running the real test_interrupt. On Linux with the fork start method, the configuration that failed on CI, and on macOS with spawn: Linux, fork macOS, spawn signal.alarm(10) join took too long — FAILURE join took too long — FAILURE this change SUCCESS SUCCESS Without the injected delay, test_multiprocessing_spawn, test_multiprocessing_forkserver, test_multiprocessing_fork, test_multiprocessing_main_handling and test_concurrent_futures pass (1427 tests). Issue: gh-157184
Open Graph Description: _kill_process() guards the join() of the killed child with a SIGALRM so that a blocked waitpid() becomes a readable error instead of a hang. The alarm has been a literal 10 seconds since it was add...
X Description: _kill_process() guards the join() of the killed child with a SIGALRM so that a blocked waitpid() becomes a readable error instead of a hang. The alarm has been a literal 10 seconds since it was add...
Opengraph URL: https://github.com/python/cpython/pull/157185
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2d3bea5d-dd9d-9f8c-c1db-4c905f856de6 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9082:136CDA:17A194F:1F46951:6B020B23 |
| html-safe-nonce | 65c4282ab765eb01b359df37ffd1d40f2819f70e2db761c824926bf7edef4c85 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDgyOjEzNkNEQToxN0ExOTRGOjFGNDY5NTE6NkIwMjBCMjMiLCJ2aXNpdG9yX2lkIjoiMzcyMTc3MDY4NjI3NzA5NDE3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2558ff313f2a72daa1f90875b9f99d51c0d9dbb02116f2626688387e156d67ff |
| hovercard-subject-tag | pull_request:4475016846 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/157185/files |
| twitter:image | https://avatars.githubusercontent.com/u/8417988?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/8417988?s=400&v=4 |
| og:image:alt | _kill_process() guards the join() of the killed child with a SIGALRM so that a blocked waitpid() becomes a readable error instead of a hang. The alarm has been a literal 10 seconds since it was add... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width