René's URL Explorer Experiment


Title: Multiprocessing with "fork" fails with Python 3.14 but works with Python 3.13 · Issue #139894 · python/cpython · GitHub

Open Graph Title: Multiprocessing with "fork" fails with Python 3.14 but works with Python 3.13 · Issue #139894 · python/cpython

X Title: Multiprocessing with "fork" fails with Python 3.14 but works with Python 3.13 · Issue #139894 · python/cpython

Description: Bug report Bug description: The following code works fine on Python 3.13, but fails on Python 3.14 with a RuntimeError related to asyncio tasks. Minimal reproducible example import asyncio import inspect from functools import wraps from ...

Open Graph Description: Bug report Bug description: The following code works fine on Python 3.13, but fails on Python 3.14 with a RuntimeError related to asyncio tasks. Minimal reproducible example import asyncio import i...

X Description: Bug report Bug description: The following code works fine on Python 3.13, but fails on Python 3.14 with a RuntimeError related to asyncio tasks. Minimal reproducible example import asyncio import i...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Multiprocessing with \"fork\" fails with Python 3.14 but works with Python 3.13","articleBody":"# Bug report\n\n### Bug description:\n\nThe following code works fine on **Python 3.13**, but fails on **Python 3.14** with a `RuntimeError` related to asyncio tasks.\n\n### Minimal reproducible example\n\n```python\nimport asyncio\nimport inspect\nfrom functools import wraps\nfrom typing import Any, Awaitable, Callable, Union\n\nimport pytest\nfrom multiprocess import Pipe, Process\nfrom multiprocess.connection import Connection\n\nimport multiprocess as mp\nmp.set_start_method(method=\"fork\", force=True)  # \"spawn\" works fine\n\n\nclass SubprocessError:\n    def __init__(self, ex: Exception) -> None:\n        self.exception = ex\n\n\ndef in_subprocess[T](func: Callable[..., Union[T, Awaitable[T]]]) -> Callable[..., Awaitable[T]]:\n    @wraps(func)\n    async def wrapper(*args: Any, **kwargs: Any) -> T:\n        return await calculate_in_subprocess(func, *args, **kwargs)\n\n    return wrapper\n\n\nasync def calculate_in_subprocess[T](func: Callable[..., Union[T, Awaitable[T]]], *args: Any, **kwargs: Any) -> T:\n    rx, tx = Pipe(duplex=False)  # receiver & transmitter ; Pipe is one-way only\n    process = Process(target=_inner, args=(tx, func, *args), kwargs=kwargs)\n    process.start()\n\n    event = asyncio.Event()\n    loop = asyncio.get_event_loop()\n    loop.add_reader(fd=rx.fileno(), callback=event.set)\n\n    if not rx.poll():  # do not use process.is_alive() as condition here\n        await event.wait()\n\n    loop.remove_reader(fd=rx.fileno())\n    event.clear()\n\n    result = rx.recv()\n    process.join()  # this blocks synchronously! make sure that process is terminated before you call join()\n    rx.close()\n    tx.close()\n\n    if isinstance(result, SubprocessError):\n        raise result.exception\n\n    return result\n\n\ndef _inner[T](tx: Connection, fun: Callable[..., Union[T, Awaitable[T]]], *a, **kw_args) -> None:\n    event_loop = None\n    if inspect.iscoroutinefunction(fun):\n        event_loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(event_loop)\n\n    try:\n        if event_loop is not None:\n            res = event_loop.run_until_complete(fun(*a, **kw_args))\n        else:\n            res = fun(*a, **kw_args)\n    except Exception as ex:\n        tx.send(SubprocessError(ex=ex))\n    else:\n        tx.send(res)\n\n\n@pytest.mark.asyncio\nasync def test_in_subprocess_simple_async():\n    @in_subprocess\n    async def f() -> int:\n        return 42\n\n    assert await f() == 42\n```\n\n---\n\n### Error message with Python 3.14\n\n```\n-------------------------------- live log call ---------------------------------\nERROR    asyncio:base_events.py:1875 Exception in callback \u003c_asyncio.TaskStepMethWrapper object at 0x7e71ba729ff0>()\nhandle: \u003cHandle \u003c_asyncio.TaskStepMethWrapper object at 0x7e71ba729ff0>()>\nTraceback (most recent call last):\n  File \"/usr/lib/python3.14/asyncio/events.py\", line 94, in _run\n    self._context.run(self._callback, *self._args)\n    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nRuntimeError: Cannot enter into task \u003cTask pending name='Task-2' coro=\u003ctest_in_subprocess_simple_async.\u003clocals>.f() running at foo.py:73> cb=[_run_until_complete_cb() at /usr/lib/python3.14/asyncio/base_events.py:181]> while another task \u003cTask pending name='Task-1' coro=\u003ctest_in_subprocess_simple_async() running at foo.py:77> cb=[_run_until_complete_cb() at /usr/lib/python3.14/asyncio/base_events.py:181]> is being executed.\n```\n\n---\n\n### Environment\n\nInstalled packages (note: `multiprocess` must be installed from GitHub):\n\n```\ncertifi==2025.10.5\ncharset-normalizer==3.4.3\ndill==0.4.0\ndocker==7.1.0\nidna==3.10\niniconfig==2.1.0\nmultiprocess @ git+https://github.com/uqfoundation/multiprocess.git@02ea4bd36cac5013d70847815c92e1a736ef4a05\npackaging==25.0\npluggy==1.6.0\nPygments==2.19.2\npytest==8.4.2\npytest-asyncio==1.2.0\npytest_docker_tools==3.1.9\nrequests==2.32.5\nurllib3==2.5.0\n```\n\n---\n\nAnd before you say, that the error is in the third-party lib `multiprocess` and I should use `multiprocessing` instead of `multiprocess`: The bug even occurs with `multiprocessing` (just replace the lib in the code example above). In Python 3.13 it will fail with a `PicklingError` (which is expected for this example) but in Python 3.14 the `RuntimeError: Cannot enter into task` will be thrown (see above). So this issue must be in Python 3.14.\n\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-139897\n* gh-139913\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/LostInDarkMath","@type":"Person","name":"LostInDarkMath"},"datePublished":"2025-10-10T08:14:16Z","url":"https://github.com/python/cpython/issues/139894"}

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:1f82c0bf-c600-5d2a-c45f-70aa34844a0d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id88D0:21BD98:37A1840:467A71A:6B0222E7
html-safe-nonce7712ef3fb01ac443eb849a99a1241c49497cdb3515adb1636041f6a20ad0d060
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEQwOjIxQkQ5ODozN0ExODQwOjQ2N0E3MUE6NkIwMjIyRTciLCJ2aXNpdG9yX2lkIjoiNjMwNjYwMTY5NzE1ODUwNTE5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac22984fd46afaf9cbf686de278fccefa33651b7f097182d2df97ef7f0861c7455
hovercard-subject-tagissue:3501853151
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/139894/issue_layout
twitter:imagehttps://opengraph.githubassets.com/cb9649d8bac9193bc06b091440e8dcf8e7ee24fb6c1a510292fc44d6f3bf01ba/python/cpython/issues/139894
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/cb9649d8bac9193bc06b091440e8dcf8e7ee24fb6c1a510292fc44d6f3bf01ba/python/cpython/issues/139894
og:image:altBug report Bug description: The following code works fine on Python 3.13, but fails on Python 3.14 with a RuntimeError related to asyncio tasks. Minimal reproducible example import asyncio import i...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameLostInDarkMath
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-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/139894#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F139894
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%2F139894
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/139894
Reloadhttps://github.com/python/cpython/issues/139894
Reloadhttps://github.com/python/cpython/issues/139894
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/139894
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/139894
#139913https://github.com/python/cpython/pull/139913
Multiprocessing with "fork" fails with Python 3.14 but works with Python 3.13https://github.com/python/cpython/issues/139894#top
#139913https://github.com/python/cpython/pull/139913
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
3.15bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.15%22
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/LostInDarkMath
LostInDarkMathhttps://github.com/LostInDarkMath
on Oct 10, 2025https://github.com/python/cpython/issues/139894#issue-3501853151
gh-139894: fix incorrect sharing of current task while forking in asyncio  #139897https://github.com/python/cpython/pull/139897
[3.14] gh-139894: fix incorrect sharing of current task while forking in asyncio (GH-139897) #139913https://github.com/python/cpython/pull/139913
LostInDarkMathhttps://github.com/LostInDarkMath
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Oct 10, 2025https://github.com/python/cpython/issues/139894#event-20201272117
kumaraditya303https://github.com/kumaraditya303
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
3.15bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.15%22
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
on Oct 10, 2025https://github.com/python/cpython/issues/139894#event-20204112980
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Oct 10, 2025https://github.com/python/cpython/issues/139894#event-20204117832
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Oct 10, 2025https://github.com/python/cpython/issues/139894
https://github.com/kumaraditya303
kumaraditya303https://github.com/kumaraditya303
on Oct 10, 2025https://github.com/python/cpython/issues/139894#issuecomment-3389474068
#139897https://github.com/python/cpython/pull/139897
#130442https://github.com/python/cpython/issues/130442
kumaraditya303https://github.com/kumaraditya303
asynciohttps://github.com/orgs/python/projects/29
on Oct 10, 2025https://github.com/python/cpython/issues/139894
kumaraditya303https://github.com/kumaraditya303
on Oct 10, 2025https://github.com/python/cpython/issues/139894#event-20212257973
gh-139894: fix incorrect sharing of current task while forking in `as…https://github.com/python/cpython/commit/b881df47ff1adca515d1de04f689160ddae72142
gh-139894https://github.com/python/cpython/issues/139894
b881df4https://github.com/python/cpython/commit/b881df47ff1adca515d1de04f689160ddae72142
[3.14] pythongh-139894: fix incorrect sharing of current task while f…https://github.com/kumaraditya303/cpython/commit/1f178daae7277625448970b9a07bfb1b9bf5419e
pythongh-139894https://github.com/python/cpython/issues/139894
1f178dahttps://github.com/kumaraditya303/cpython/commit/1f178daae7277625448970b9a07bfb1b9bf5419e
[3.14] pythongh-139894: fix incorrect sharing of current task while f…https://github.com/kumaraditya303/cpython/commit/d0521db9144ba2c8ff00a66657bc2b5f10fe58c3
pythongh-139894https://github.com/python/cpython/issues/139894
d0521dbhttps://github.com/kumaraditya303/cpython/commit/d0521db9144ba2c8ff00a66657bc2b5f10fe58c3
kumaraditya303https://github.com/kumaraditya303
[3.14] gh-139894: fix incorrect sharing of current task while forking in `asyncio` (GH-139897) #139913https://github.com/python/cpython/pull/139913
on Oct 10, 2025https://github.com/python/cpython/issues/139894#event-20212723556
kumaraditya303https://github.com/kumaraditya303
on Oct 10, 2025https://github.com/python/cpython/issues/139894#event-20213051176
[3.14] gh-139894: fix incorrect sharing of current task while forking…https://github.com/python/cpython/commit/72f25a8d9a5673d39c107cf522465a566b979ed5
gh-139894https://github.com/python/cpython/issues/139894
72f25a8https://github.com/python/cpython/commit/72f25a8d9a5673d39c107cf522465a566b979ed5
kumaraditya303https://github.com/kumaraditya303
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 10, 2025https://github.com/python/cpython/issues/139894#event-20213095348
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Oct 10, 2025https://github.com/python/cpython/issues/139894
github-merge-queuehttps://github.com/apps/github-merge-queue
on Nov 30, 2025https://github.com/python/cpython/issues/139894#event-21260454349
fix(run): configure spawn start method on macOS to avoid fork warnings (https://github.com/UMEP-dev/SUEWS/commit/c9c33f7f40be442e5ef29b9d4bb4b4af213b0784
c9c33f7https://github.com/UMEP-dev/SUEWS/commit/c9c33f7f40be442e5ef29b9d4bb4b4af213b0784
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/139894
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/139894
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
3.15bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.15%22
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
asynciohttps://github.com/orgs/python/projects/29
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.