Title: Asynchronous multiprocessing.Pipe reads throw when using uvloop · Issue #686 · MagicStack/uvloop · GitHub
Open Graph Title: Asynchronous multiprocessing.Pipe reads throw when using uvloop · Issue #686 · MagicStack/uvloop
X Title: Asynchronous multiprocessing.Pipe reads throw when using uvloop · Issue #686 · MagicStack/uvloop
Description: Summary When using an asyncio.Event() with loop.add_reader() to asynchronously read from a multiprocessing.Pipe, the call to recv_bytes() throws: Process reader: Traceback (most recent call last): File "/home/james/.pyenv/versions/3.13.5...
Open Graph Description: Summary When using an asyncio.Event() with loop.add_reader() to asynchronously read from a multiprocessing.Pipe, the call to recv_bytes() throws: Process reader: Traceback (most recent call last): ...
X Description: Summary When using an asyncio.Event() with loop.add_reader() to asynchronously read from a multiprocessing.Pipe, the call to recv_bytes() throws: Process reader: Traceback (most recent call last): ...
Opengraph URL: https://github.com/MagicStack/uvloop/issues/686
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Asynchronous multiprocessing.Pipe reads throw when using uvloop","articleBody":"## Summary\n\nWhen using an `asyncio.Event()` with `loop.add_reader()` to asynchronously read from a `multiprocessing.Pipe`, the call to `recv_bytes()` throws:\n\n```\nProcess reader:\nTraceback (most recent call last):\n File \"/home/james/.pyenv/versions/3.13.5/lib/python3.13/multiprocessing/process.py\", line 313, in _bootstrap\n self.run()\n ~~~~~~~~^^\n File \"/home/james/.pyenv/versions/3.13.5/lib/python3.13/multiprocessing/process.py\", line 108, in run\n self._target(*self._args, **self._kwargs)\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/james/code/connection_test.py\", line 25, in reader_wrapper\n uvloop.run(async_reader(read_pipe))\n ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/james/code/.venv/lib/python3.13/site-packages/uvloop/__init__.py\", line 109, in run\n return __asyncio.run(\n ~~~~~~~~~~~~~^\n wrapper(),\n ^^^^^^^^^^\n ...\u003c2 lines\u003e...\n **run_kwargs\n ^^^^^^^^^^^^\n )\n ^\n File \"/home/james/.pyenv/versions/3.13.5/lib/python3.13/asyncio/runners.py\", line 195, in run\n return runner.run(main)\n ~~~~~~~~~~^^^^^^\n File \"/home/james/.pyenv/versions/3.13.5/lib/python3.13/asyncio/runners.py\", line 118, in run\n return self._loop.run_until_complete(task)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"uvloop/loop.pyx\", line 1518, in uvloop.loop.Loop.run_until_complete\n File \"/home/james/code/.venv/lib/python3.13/site-packages/uvloop/__init__.py\", line 61, in wrapper\n return await main\n ^^^^^^^^^^\n File \"/home/james/code/connection_test.py\", line 20, in async_reader\n message = read_pipe.recv_bytes()\n File \"/home/james/.pyenv/versions/3.13.5/lib/python3.13/multiprocessing/connection.py\", line 216, in recv_bytes\n buf = self._recv_bytes(maxlength)\n File \"/home/james/.pyenv/versions/3.13.5/lib/python3.13/multiprocessing/connection.py\", line 437, in _recv_bytes\n return self._recv(size)\n ~~~~~~~~~~^^^^^^\n File \"/home/james/.pyenv/versions/3.13.5/lib/python3.13/multiprocessing/connection.py\", line 395, in _recv\n chunk = read(handle, remaining)\nBlockingIOError: [Errno 11] Resource temporarily unavailable\n```\n\nThis does not occur when running with `asyncio`\n\n## Environment\n\n Python: 3.13.5\n uvloop: 0.21.0\n\n## Reproduction\n\n```python\nimport asyncio\nimport uvloop\nfrom multiprocessing import Process\nfrom multiprocessing.connection import Connection, Pipe, wait\n\ndef writer(write_pipe: Connection):\n message = b'!' * 65536\n while True:\n write_pipe.send_bytes(message)\n\nasync def async_reader(read_pipe: Connection):\n message_available = asyncio.Event()\n asyncio.get_running_loop().add_reader(\n read_pipe.fileno(), message_available.set\n )\n\n while True:\n await message_available.wait()\n while read_pipe.poll():\n message = read_pipe.recv_bytes()\n print('Got message')\n message_available.clear()\n\ndef reader_wrapper(read_pipe: Connection):\n uvloop.run(async_reader(read_pipe))\n\nif __name__ == '__main__':\n read_pipe, write_pipe = Pipe(duplex=False)\n\n reader_process = Process(\n name=\"reader\", target=reader_wrapper, args=(read_pipe,)\n )\n reader_process.start()\n\n writer_process = Process(\n name=\"writer\", target=writer, args=(write_pipe,)\n )\n writer_process.start()\n\n wait([reader_process.sentinel, writer_process.sentinel])\n\n```","author":{"url":"https://github.com/judilsteve","@type":"Person","name":"judilsteve"},"datePublished":"2025-08-15T02:16:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/686/uvloop/issues/686"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:16489b13-de35-8454-f7d4-f4468eab99ee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8E8:286E94:2CABEB9:3ACA533:69649535 |
| html-safe-nonce | 4d067fb7e4d72f06701a4aff31eaa85a2b446a6fbfca019596f9525ef40912bc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEU4OjI4NkU5NDoyQ0FCRUI5OjNBQ0E1MzM6Njk2NDk1MzUiLCJ2aXNpdG9yX2lkIjoiODcwNDc1MzczMTM0MjU1NDEzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 37e22d39aea821be914c9910f736b9f4c5423aa56586d6e682953bb7644b885f |
| hovercard-subject-tag | issue:3324113350 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/MagicStack/uvloop/686/issue_layout |
| twitter:image | https://opengraph.githubassets.com/05519adfed5ecce4e0f7aa4b4a6c4b9338ccff7221f223f6f6b9807ac62d922b/MagicStack/uvloop/issues/686 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/05519adfed5ecce4e0f7aa4b4a6c4b9338ccff7221f223f6f6b9807ac62d922b/MagicStack/uvloop/issues/686 |
| og:image:alt | Summary When using an asyncio.Event() with loop.add_reader() to asynchronously read from a multiprocessing.Pipe, the call to recv_bytes() throws: Process reader: Traceback (most recent call last): ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | judilsteve |
| hostname | github.com |
| expected-hostname | github.com |
| None | baa7d9900fdf7b27d604f36887af878d569cfbdcf97126832a5f4f0caf0c6ba5 |
| turbo-cache-control | no-preview |
| go-import | github.com/MagicStack/uvloop git https://github.com/MagicStack/uvloop.git |
| octolytics-dimension-user_id | 14324950 |
| octolytics-dimension-user_login | MagicStack |
| octolytics-dimension-repository_id | 45766550 |
| octolytics-dimension-repository_nwo | MagicStack/uvloop |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45766550 |
| octolytics-dimension-repository_network_root_nwo | MagicStack/uvloop |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 842eff1d11f899d02b6b3b98fa3ea4860e64b34e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width