Title: pty.spawn deadlock · Issue #96522 · python/cpython · GitHub
Open Graph Title: pty.spawn deadlock · Issue #96522 · python/cpython
X Title: pty.spawn deadlock · Issue #96522 · python/cpython
Description: Bug report % yes | python3 -c "import pty; pty.spawn(['cat'])" y ... y^CTraceback (most recent call last): File "
Open Graph Description: Bug report % yes | python3 -c "import pty; pty.spawn(['cat'])" y ... y^CTraceback (most recent call last): File "
X Description: Bug report % yes | python3 -c "import pty; pty.spawn(['cat'])" y ... y^CTraceback (most recent call last): File "<string>", line 1, in <module> File "/u...
Opengraph URL: https://github.com/python/cpython/issues/96522
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pty.spawn deadlock","articleBody":"# Bug report\r\n\r\n```\r\n% yes | python3 -c \"import pty; pty.spawn(['cat'])\"\r\ny\r\n...\r\ny^CTraceback (most recent call last):\r\n File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/usr/lib/python3.10/pty.py\", line 181, in spawn\r\n _copy(master_fd, master_read, stdin_read)\r\n File \"/usr/lib/python3.10/pty.py\", line 161, in _copy\r\n _writen(master_fd, data)\r\n File \"/usr/lib/python3.10/pty.py\", line 127, in _writen\r\n n = os.write(fd, data)\r\nKeyboardInterrupt\r\n```\r\n\r\nYou will see 2048 lines of y due to tty echo, then the output stops and hangs forever.\r\nBoth python and cat block on write, waiting each other consume something from pty buffer.\r\n\r\n# Your environment\r\n\r\nTested on Linux/macOS with CPython 3.10.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-96639\n* gh-104655\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/zhangyoufu","@type":"Person","name":"zhangyoufu"},"datePublished":"2022-09-03T05:27:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/96522/cpython/issues/96522"}
| 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:e39b0638-addf-2d10-d656-f2a18ba7e984 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DEC:10DE44:5033DB:6CA299:6969D9E6 |
| html-safe-nonce | a50298beed009cc8025c117322eb946bb041da592f196465ea16098c2e48b37a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REVDOjEwREU0NDo1MDMzREI6NkNBMjk5OjY5NjlEOUU2IiwidmlzaXRvcl9pZCI6IjYxMTA5MzE5ODUwODI0NzI5MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 79f09a9ac678e7dc0ef3aaca3b407c78f41f05465c7dabf6390c91f89b82e760 |
| hovercard-subject-tag | issue:1360762407 |
| 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/python/cpython/96522/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e95d9111e2e0cdb233caa6e0b0231e0750a5e19cea1c0c1e761c195a4f48ac18/python/cpython/issues/96522 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e95d9111e2e0cdb233caa6e0b0231e0750a5e19cea1c0c1e761c195a4f48ac18/python/cpython/issues/96522 |
| og:image:alt | Bug report % yes | python3 -c "import pty; pty.spawn(['cat'])" y ... y^CTraceback (most recent call last): File " |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zhangyoufu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| 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 | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width