Title: deadlocked child process after forking on pystate.c's HEAD_LOCK · Issue #112275 · python/cpython · GitHub
Open Graph Title: deadlocked child process after forking on pystate.c's HEAD_LOCK · Issue #112275 · python/cpython
X Title: deadlocked child process after forking on pystate.c's HEAD_LOCK · Issue #112275 · python/cpython
Description: Bug report Bug description: A forked process (via os.fork) can inherit a locked runtime->interpreters.mutex from its parent process and will deadlock in this stack: Child Process (deadlocked): #0 0x0000ffffa9b2b268 in do_futex_wait.const...
Open Graph Description: Bug report Bug description: A forked process (via os.fork) can inherit a locked runtime->interpreters.mutex from its parent process and will deadlock in this stack: Child Process (deadlocked): #0 0...
X Description: Bug report Bug description: A forked process (via os.fork) can inherit a locked runtime->interpreters.mutex from its parent process and will deadlock in this stack: Child Process (deadlocked): #...
Opengraph URL: https://github.com/python/cpython/issues/112275
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"deadlocked child process after forking on pystate.c's HEAD_LOCK","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nA forked process (via os.fork) can inherit a locked runtime-\u003einterpreters.mutex from its parent process and will deadlock in this stack:\r\nChild Process (deadlocked):\r\n#0 0x0000ffffa9b2b268 in do_futex_wait.constprop () from /lib/aarch64-linux-gnu/libpthread.so.0\r\n#1 0x0000ffffa9b2b39c in __new_sem_wait_slow.constprop.0 () from /lib/aarch64-linux-gnu/libpthread.so.0\r\n#2 0x0000ffffa9e96eb8 in PyThread_acquire_lock_timed () from /usr/local/lib/libpython3.8.so.1.0\r\n#3 0x0000ffffa9e865a8 in _PyThreadState_DeleteExcept () from /usr/local/lib/libpython3.8.so.1.0\r\n#4 0x0000ffffa9eb94ac in PyOS_AfterFork_Child () from /usr/local/lib/libpython3.8.so.1.0\r\n\r\nSimilar to https://github.com/python/cpython/issues/74580 and it's solved by https://github.com/python/cpython/commit/f82c951d1c5416f3550d544e50ff5662d3836e73 on python3.6 and 3.7\r\n\r\nHowever,the problem appeares again on python3.8: HEAD_LOCK is called from PyOS_AfterFork_Child-\u003e_PyEval_ReInitThreads-\u003e_PyThreadState_DeleteExcept before PyOS_AfterFork_Child-\u003e_PyRuntimeState_ReInitThreads reinit runtime-\u003einterpreters.mutex.\r\n\r\nI notice the problem will be resolved on python3.12 from the source code,but is it still existed on python3.8 to 3.11?\r\n\r\n\r\n\r\n### CPython versions tested on:\r\n\r\n3.8\r\n\r\n### Operating systems tested on:\r\n\r\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-112336\n* gh-123687\n* gh-123688\n* gh-123713\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/ChuBoning","@type":"Person","name":"ChuBoning"},"datePublished":"2023-11-20T02:31:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/112275/cpython/issues/112275"}
| 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:079b0ae2-3751-16c0-8bd3-3d803f286ae8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A2DC:125688:7B8E35:A70314:6969BA20 |
| html-safe-nonce | b0f2ecadf62e4c5ce1afb9491268201b53f8ef3317150172667c0533e78a38b2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMkRDOjEyNTY4ODo3QjhFMzU6QTcwMzE0OjY5NjlCQTIwIiwidmlzaXRvcl9pZCI6IjYwNjY3ODMyMjE2Nzc5MzEwNDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 72f964a0073df5b7646251086f1a610e3045e6c247cf88160a53f6237c71b5c3 |
| hovercard-subject-tag | issue:2001245856 |
| 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/112275/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ba26a635ab1036d56f75ac2d7e4cf45dc389d66c9cbd4507821cd053b6431492/python/cpython/issues/112275 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ba26a635ab1036d56f75ac2d7e4cf45dc389d66c9cbd4507821cd053b6431492/python/cpython/issues/112275 |
| og:image:alt | Bug report Bug description: A forked process (via os.fork) can inherit a locked runtime->interpreters.mutex from its parent process and will deadlock in this stack: Child Process (deadlocked): #0 0... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ChuBoning |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width