René's URL Explorer Experiment


Title: ProactorEventLoop datagram transports drop buffered datagrams on close() and never call connection_lost() · Issue #156920 · python/cpython · GitHub

Open Graph Title: ProactorEventLoop datagram transports drop buffered datagrams on close() and never call connection_lost() · Issue #156920 · python/cpython

X Title: ProactorEventLoop datagram transports drop buffered datagrams on close() and never call connection_lost() · Issue #156920 · python/cpython

Description: Bug report Bug description: Closing a datagram transport that still has datagrams queued drops them and never calls connection_lost(), so the socket is closed only by __del__, with a ResourceWarning; SelectorEventLoop flushes them and te...

Open Graph Description: Bug report Bug description: Closing a datagram transport that still has datagrams queued drops them and never calls connection_lost(), so the socket is closed only by __del__, with a ResourceWarnin...

X Description: Bug report Bug description: Closing a datagram transport that still has datagrams queued drops them and never calls connection_lost(), so the socket is closed only by __del__, with a ResourceWarnin...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ProactorEventLoop datagram transports drop buffered datagrams on close() and never call connection_lost()","articleBody":"# Bug report\n\n### Bug description:\n\nClosing a datagram transport that still has datagrams queued drops them and\nnever calls `connection_lost()`, so the socket is closed only by `__del__`,\nwith a `ResourceWarning`; `SelectorEventLoop` flushes them and tears down\nnormally. `_ProactorDatagramTransport._loop_writing()` returns at\n`if self._conn_lost: return`, which `close()` has just incremented, so the\nteardown branch below it -- the one `close()` deliberately leaves to the\nwrite loop when the buffer is non-empty -- is unreachable.\n\n## Reproducer\n\n```python\nimport asyncio\nimport sys\n\n\nasync def main():\n    loop = asyncio.get_running_loop()\n    print(sys.version)\n    print(type(loop).__name__)\n    received = []\n    lost = loop.create_future()\n\n    class Receiver(asyncio.DatagramProtocol):\n        def datagram_received(self, data, addr):\n            received.append(data)\n\n    class Sender(asyncio.DatagramProtocol):\n        def connection_lost(self, exc):\n            if not lost.done():\n                lost.set_result(exc)\n\n    recv_transport, _ = await loop.create_datagram_endpoint(\n        Receiver, local_addr=('127.0.0.1', 0))\n    addr = recv_transport.get_extra_info('sockname')\n\n    transport, _ = await loop.create_datagram_endpoint(\n        Sender, remote_addr=addr)\n\n    for i in range(5):\n        transport.sendto(b'datagram-%d' % i)\n    transport.close()\n\n    try:\n        await asyncio.wait_for(lost, 5)\n    except TimeoutError:\n        print('connection_lost(): never called')\n    else:\n        print('connection_lost(): called')\n\n    await asyncio.sleep(0.5)\n    print('datagrams received:', len(received))\n    print('write buffer size: ', transport.get_write_buffer_size())\n    recv_transport.close()\n    await asyncio.sleep(0)\n\n\nasyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)\nasyncio.run(main(), loop_factory=asyncio.ProactorEventLoop)\n```\n\nOutput on Windows:\n```\nPS C:\\Users\\tagra\\projects\\cpython> py -3.14 .\\reproducer.py\n3.14.7 (tags/v3.14.7:823f032, Aug  5 2026, 10:51:32) [MSC v.1944 64 bit (AMD64)]\n_WindowsSelectorEventLoop\nconnection_lost(): called\ndatagrams received: 5\nwrite buffer size:  0\n3.14.7 (tags/v3.14.7:823f032, Aug  5 2026, 10:51:32) [MSC v.1944 64 bit (AMD64)]\nProactorEventLoop\nconnection_lost(): never called\ndatagrams received: 1\nwrite buffer size:  72\nPS C:\\Users\\tagra\\projects\\cpython> py -3.13 .\\reproducer.py\n3.13.15 (tags/v3.13.15:4061bc4, Aug  5 2026, 13:05:39) [MSC v.1944 64 bit (AMD64)]\n_WindowsSelectorEventLoop\nconnection_lost(): called\ndatagrams received: 5\nwrite buffer size:  0\n3.13.15 (tags/v3.13.15:4061bc4, Aug  5 2026, 13:05:39) [MSC v.1944 64 bit (AMD64)]\nProactorEventLoop\nconnection_lost(): never called\ndatagrams received: 1\nwrite buffer size:  72\n```\n\n## CPython versions tested on\n\nPy3.13 Py3.14\n\n## Operating systems tested on\n\nWindows\n\n### CPython versions tested on:\n\n3.13, 3.14\n\n### Operating systems tested on:\n\nWindows\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-156921\n* gh-157607\n* gh-157608\n* gh-157609\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2026-09-04T09:15:57Z","url":"https://github.com/python/cpython/issues/156920"}

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:585e819e-a386-6230-16e9-8b9463f899e6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id86A6:6365:3459256:45D5099:6B020371
html-safe-nonce6c99d5eb3bf9c5ddc1ff7f6517f9fff8c505788793e1c90a5e92976b3172c371
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkE2OjYzNjU6MzQ1OTI1Njo0NUQ1MDk5OjZCMDIwMzcxIiwidmlzaXRvcl9pZCI6IjEzNDc1ODc0MDcyODQ5MjkzOTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4be57c91feb2bdffc76ab0b50291dcec8e17b9ce24f9a56847ddd54d5ce6ea5f
hovercard-subject-tagissue:5346356011
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/156920/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fbc63c62364a3dfb95415c61d7724ae67c48cf655e9ebd91e65e06a3885ec825/python/cpython/issues/156920
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fbc63c62364a3dfb95415c61d7724ae67c48cf655e9ebd91e65e06a3885ec825/python/cpython/issues/156920
og:image:altBug report Bug description: Closing a datagram transport that still has datagrams queued drops them and never calls connection_lost(), so the socket is closed only by __del__, with a ResourceWarnin...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegraingert
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/156920#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F156920
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%2F156920
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/156920
Reloadhttps://github.com/python/cpython/issues/156920
Reloadhttps://github.com/python/cpython/issues/156920
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/156920
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/156920
ProactorEventLoop datagram transports drop buffered datagrams on close() and never call connection_lost()https://github.com/python/cpython/issues/156920#top
OS-windowshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22OS-windows%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%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/graingert
graingerthttps://github.com/graingert
on Sep 4, 2026https://github.com/python/cpython/issues/156920#issue-5346356011
gh-156920, gh-156698: fix ProactorEventLoop datagram transport hangs on close() and after write errors #156921https://github.com/python/cpython/pull/156921
[3.15] gh-156920, gh-156698: fix ProactorEventLoop datagram transport hangs on close() and after write errors (GH-156921) #157607https://github.com/python/cpython/pull/157607
[3.14] gh-156920, gh-156698: fix ProactorEventLoop datagram transport hangs on close() and after write errors (GH-156921) #157608https://github.com/python/cpython/pull/157608
[3.13] gh-156920, gh-156698: fix ProactorEventLoop datagram transport hangs on close() and after write errors (GH-156921) #157609https://github.com/python/cpython/pull/157609
graingerthttps://github.com/graingert
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
on Sep 4, 2026https://github.com/python/cpython/issues/156920#event-30544027863
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Sep 4, 2026https://github.com/python/cpython/issues/156920#event-30544029717
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Sep 4, 2026https://github.com/python/cpython/issues/156920
graingerthttps://github.com/graingert
on Sep 4, 2026https://github.com/python/cpython/issues/156920#event-30544173407
pythongh-156920: fix ProactorEventLoop datagram transports drop buffe…https://github.com/graingert/cpython/commit/f843371eff4f1ccdac9008ed47ae0bf49bdb2dc1
pythongh-156920https://github.com/python/cpython/issues/156920
f843371https://github.com/graingert/cpython/commit/f843371eff4f1ccdac9008ed47ae0bf49bdb2dc1
picnixzhttps://github.com/picnixz
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Sep 4, 2026https://github.com/python/cpython/issues/156920#event-30544740452
aiskhttps://github.com/aisk
OS-windowshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22OS-windows%22
on Sep 4, 2026https://github.com/python/cpython/issues/156920#event-30547665187
kumaraditya303https://github.com/kumaraditya303
on Sep 16, 2026https://github.com/python/cpython/issues/156920#event-31224064849
gh-156920, gh-156698: fix ProactorEventLoop datagram transport hangs …https://github.com/python/cpython/commit/7f52444d9b593413e6dd376f211dcbb58cc130f4
gh-156920https://github.com/python/cpython/issues/156920
gh-156698https://github.com/python/cpython/issues/156698
7f52444https://github.com/python/cpython/commit/7f52444d9b593413e6dd376f211dcbb58cc130f4
kumaraditya303https://github.com/kumaraditya303
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 16, 2026https://github.com/python/cpython/issues/156920#event-31224120657
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Sep 16, 2026https://github.com/python/cpython/issues/156920
Yhg1shttps://github.com/Yhg1s
on Sep 29, 2026https://github.com/python/cpython/issues/156920#event-32116268462
[3.13] gh-156920, gh-156698: fix ProactorEventLoop datagram transport…https://github.com/python/cpython/commit/0557ba8914237185b0efa112112747bbcc2a7bc7
gh-156920https://github.com/python/cpython/issues/156920
gh-156698https://github.com/python/cpython/issues/156698
0557ba8https://github.com/python/cpython/commit/0557ba8914237185b0efa112112747bbcc2a7bc7
encukouhttps://github.com/encukou
on Oct 12, 2026https://github.com/python/cpython/issues/156920#event-33043145131
[3.15] gh-156920, gh-156698: fix ProactorEventLoop datagram transport…https://github.com/python/cpython/commit/bbdef1f054bde457826e8e2a4abaa93f787549c8
gh-156920https://github.com/python/cpython/issues/156920
gh-156698https://github.com/python/cpython/issues/156698
bbdef1fhttps://github.com/python/cpython/commit/bbdef1f054bde457826e8e2a4abaa93f787549c8
[3.14] gh-156920, gh-156698: fix ProactorEventLoop datagram transport…https://github.com/python/cpython/commit/60067a6bbad9f5556106a807f7102b6a797129a2
gh-156920https://github.com/python/cpython/issues/156920
gh-156698https://github.com/python/cpython/issues/156698
60067a6https://github.com/python/cpython/commit/60067a6bbad9f5556106a807f7102b6a797129a2
jlainehttps://github.com/jlaine
on Nov 1, 2026https://github.com/python/cpython/issues/156920#event-34825941257
Do not run tests on Windows with Python 3.11 and 3.12https://github.com/jlaine/aioice/commit/fe434a48712f58e02d5e422480f847deccbe66d0
fe434a4https://github.com/jlaine/aioice/commit/fe434a48712f58e02d5e422480f847deccbe66d0
Do not run tests on Windows with Python 3.11 and 3.12https://github.com/aiortc/aioice/commit/45ac94d77c325ba64d1a768bade29014511c4d17
45ac94dhttps://github.com/aiortc/aioice/commit/45ac94d77c325ba64d1a768bade29014511c4d17
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/156920
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/156920
OS-windowshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22OS-windows%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%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.