René's URL Explorer Experiment


Title: test_forkserver_sigkill: join() can return before the child sets the event · Issue #160295 · python/cpython · GitHub

Open Graph Title: test_forkserver_sigkill: join() can return before the child sets the event · Issue #160295 · python/cpython

X Title: test_forkserver_sigkill: join() can return before the child sets the event · Issue #160295 · python/cpython

Description: Bug report Bug description: test_forkserver_sigkill failed once during a full ./python.exe -m test -j0 run on my machine (macOS 27.0.1, Apple M3, pydebug build of main at 1705e51). The load average was around 65 at the time. It passes wh...

Open Graph Description: Bug report Bug description: test_forkserver_sigkill failed once during a full ./python.exe -m test -j0 run on my machine (macOS 27.0.1, Apple M3, pydebug build of main at 1705e51). The load average...

X Description: Bug report Bug description: test_forkserver_sigkill failed once during a full ./python.exe -m test -j0 run on my machine (macOS 27.0.1, Apple M3, pydebug build of main at 1705e51). The load average...

Opengraph URL: https://github.com/python/cpython/issues/160295

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_forkserver_sigkill: join() can return before the child sets the event","articleBody":"# Bug report\n\n### Bug description:\n\n`test_forkserver_sigkill` failed once during a full `./python.exe -m test -j0` run on my machine (macOS 27.0.1, Apple M3, pydebug build of main at 1705e512b30). The load average was around 65 at the time. It passes when run on its own.\n\n```\ntest test.test_multiprocessing_forkserver.test_processes failed -- Traceback (most recent call last):\n  File \"Lib/test/_test_multiprocessing.py\", line 1007, in test_forkserver_sigkill\n    self.check_forkserver_death(signal.SIGKILL)\n  File \"Lib/test/_test_multiprocessing.py\", line 997, in check_forkserver_death\n    self.assertTrue(evt.is_set())\nAssertionError: False is not true\n```\n\n(paths shortened)\n\nThis is the same failure as gh-78221 (bpo-34040). It was worked around in 2018 by shortening the child's delay relative to the parent's sleep (07888e1cce), but the race is still there.\n\n`check_forkserver_death()` kills the forkserver right after starting the first process. After a SIGKILL, the forkserver can no longer report that child's exit status: `proc.join()` gets EOF on the status pipe, and `Popen.poll()` in `Lib/multiprocessing/popen_forkserver.py` sets `returncode` to 255 immediately. The child may still be running at that point. The test then checks `evt.is_set()`, which only passes if the child has set the event by then (within the 1 second sleep plus the time `proc2` takes). The next line already accepts exit code 255 for the case where the forkserver was killed.\n\nSIGINT is not affected: the forkserver ignores it, stays alive and reports the real exit code.\n\nTo reproduce it reliably, stop the first child with SIGSTOP for a few seconds after killing the forkserver:\n\n\u003cdetails>\n\u003csummary>Reproducer\u003c/summary>\n\n```python\nimport multiprocessing as mp, os, signal, threading, time\nfrom multiprocessing.forkserver import _forkserver\n\ndef sleep_and_set(evt, delay=0.0):\n    time.sleep(delay)\n    evt.set()\n\nif __name__ == '__main__':\n    mp.set_start_method('forkserver')\n    _forkserver.ensure_running()\n    evt = mp.Event()\n    proc = mp.Process(target=sleep_and_set, args=(evt, 0.5))\n    proc.start()\n    os.kill(_forkserver._forkserver_pid, signal.SIGKILL)\n    # Simulate the child not getting CPU time for 3 seconds.\n    os.kill(proc.pid, signal.SIGSTOP)\n    threading.Timer(3.0, os.kill, (proc.pid, signal.SIGCONT)).start()\n    time.sleep(1.0)\n    proc.join()\n    print(proc.exitcode, evt.is_set())  # 255 False\n    print(evt.wait(60))                 # True: the child did run, later\n```\n\n\u003c/details>\n\nWaiting for the event with a timeout, instead of checking it right after `join()`, fixes it.\n\nThe same code is in 3.13, 3.14 and 3.15.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS, Linux\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-160296\n* gh-160508\n* gh-160509\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/devdavidejesus","@type":"Person","name":"devdavidejesus"},"datePublished":"2026-10-22T18:30:33Z","url":"https://github.com/python/cpython/issues/160295"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:50f2bc87-3e9b-89b3-fad5-f853ebc32423
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDA5A:33E41:2D20A7:3BD563:6B023346
html-safe-nonce64553c107044a7017c6c79fd5bc00912d1243fdfe8ead1458bc0078cb71df339
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTVBOjMzRTQxOjJEMjBBNzozQkQ1NjM6NkIwMjMzNDYiLCJ2aXNpdG9yX2lkIjoiOTAxMDk5ODU4MDMxMTM3MjYxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9b47e06ef1a751349f5a2086ea72ce8331ad4f38b2a1111f62fabea8c8a22a38
hovercard-subject-tagissue:5985208409
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/160295/issue_layout
twitter:imagehttps://opengraph.githubassets.com/88f1f53fdba1e48e803a5612b82fad2d823d8ba2302da900630f351c660f6dbe/python/cpython/issues/160295
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/88f1f53fdba1e48e803a5612b82fad2d823d8ba2302da900630f351c660f6dbe/python/cpython/issues/160295
og:image:altBug report Bug description: test_forkserver_sigkill failed once during a full ./python.exe -m test -j0 run on my machine (macOS 27.0.1, Apple M3, pydebug build of main at 1705e51). The load average...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedevdavidejesus
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/160295#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F160295
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F160295
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/160295
Reloadhttps://github.com/python/cpython/issues/160295
Reloadhttps://github.com/python/cpython/issues/160295
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/160295
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/160295
#160296https://github.com/python/cpython/pull/160296
test_forkserver_sigkill: join() can return before the child sets the eventhttps://github.com/python/cpython/issues/160295#top
#160296https://github.com/python/cpython/pull/160296
testsTests in the Lib/test dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22tests%22
topic-multiprocessinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-multiprocessing%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/devdavidejesus
devdavidejesushttps://github.com/devdavidejesus
on Oct 22, 2026https://github.com/python/cpython/issues/160295#issue-5985208409
1705e51https://github.com/python/cpython/commit/1705e512b3098dce53991234a49636de2167efc3
gh-78221https://github.com/python/cpython/issues/78221
bpo-34040https://bugs.python.org/issue?@action=redirect&bpo=34040
07888e1https://github.com/python/cpython/commit/07888e1cce89e9bb7dc501e287b4cb126e01c378
gh-160295: Fix race in test_forkserver_sigkill #160296https://github.com/python/cpython/pull/160296
[3.15] gh-160295: Fix race in test_forkserver_sigkill (GH-160296) #160508https://github.com/python/cpython/pull/160508
[3.14] gh-160295: Fix race in test_forkserver_sigkill (GH-160296) #160509https://github.com/python/cpython/pull/160509
NekoAsakurahttps://github.com/NekoAsakura
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
testsTests in the Lib/test dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22tests%22
topic-multiprocessinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-multiprocessing%22
on Oct 22, 2026https://github.com/python/cpython/issues/160295#event-33982229485
gpsheadhttps://github.com/gpshead
on Oct 23, 2026https://github.com/python/cpython/issues/160295#event-34092724922
gh-160295: Fix race in test_forkserver_sigkill (GH-160296)https://github.com/python/cpython/commit/40c8edd2ca1e8df67ae8a5f02a660ff3ce1f061b
gh-160295https://github.com/python/cpython/issues/160295
GH-160296https://github.com/python/cpython/pull/160296
40c8eddhttps://github.com/python/cpython/commit/40c8edd2ca1e8df67ae8a5f02a660ff3ce1f061b
gpsheadhttps://github.com/gpshead
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#160296https://github.com/python/cpython/pull/160296
on Oct 23, 2026https://github.com/python/cpython/issues/160295#event-34092725312
hugovkhttps://github.com/hugovk
on Oct 25, 2026https://github.com/python/cpython/issues/160295#event-34185672211
[3.15] gh-160295: Fix race in test_forkserver_sigkill (GH-160296) (#1…https://github.com/python/cpython/commit/d5572556fde00c1796296deb0d63b071001c356d
gh-160295https://github.com/python/cpython/issues/160295
GH-160296https://github.com/python/cpython/pull/160296
#1…https://github.com/python/cpython/pull/160508
d557255https://github.com/python/cpython/commit/d5572556fde00c1796296deb0d63b071001c356d
[3.14] gh-160295: Fix race in test_forkserver_sigkill (GH-160296) (#1…https://github.com/python/cpython/commit/3bb7cbf342f49a0a07615d55b96c0258b232f04d
gh-160295https://github.com/python/cpython/issues/160295
GH-160296https://github.com/python/cpython/pull/160296
#1…https://github.com/python/cpython/pull/160509
3bb7cbfhttps://github.com/python/cpython/commit/3bb7cbf342f49a0a07615d55b96c0258b232f04d
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/160295
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/160295
testsTests in the Lib/test dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22tests%22
topic-multiprocessinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-multiprocessing%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.