Title: cProfile hangs / segfaults with 3.13t · Issue #125165 · python/cpython · GitHub
Open Graph Title: cProfile hangs / segfaults with 3.13t · Issue #125165 · python/cpython
X Title: cProfile hangs / segfaults with 3.13t · Issue #125165 · python/cpython
Description: Bug report Bug description: I'm testing Python 3.13t and trying to run cProfile in a context manager, however it seems to hang and/or segfault. Below script repros the issue. With > python -Xgil=1 test_cProfile.py profile it succeeds as ...
Open Graph Description: Bug report Bug description: I'm testing Python 3.13t and trying to run cProfile in a context manager, however it seems to hang and/or segfault. Below script repros the issue. With > python -Xgil=1 ...
X Description: Bug report Bug description: I'm testing Python 3.13t and trying to run cProfile in a context manager, however it seems to hang and/or segfault. Below script repros the issue. With > python -...
Opengraph URL: https://github.com/python/cpython/issues/125165
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"cProfile hangs / segfaults with 3.13t","articleBody":"# Bug report\n\n### Bug description:\n\nI'm testing Python 3.13t and trying to run cProfile in a context manager, however it seems to hang and/or segfault. \n\nBelow script repros the issue. \n\nWith `\u003e python -Xgil=1 test_cProfile.py profile`\nit succeeds as expected, however disabling `-Xgil=0` causes it to usually hang.\n\n```python\n\"\"\" example script showing deadlock with python 3.13t and cProfile context manager\npython -Xgil=0 test_cProfile.py # runs normally\npython -Xgil=0 test_cProfile.py profile # hangs\n\"\"\"\nimport cProfile\nimport sys\nimport time\nimport threading\nimport queue\ndef worker(wid, q, stop):\n while not stop.is_set():\n try:\n x = q.get(timeout=1.)\n print(wid, x)\n except queue.Empty:\n continue\ndef run():\n stop = threading.Event()\n workers = []\n queues = []\n num_workers=2\n for wid in range(num_workers):\n queues.append(queue.Queue())\n workers.append(threading.Thread(target=worker, args=(wid, queues[-1], stop)))\n workers[-1].start()\n \n for i in range(100):\n queues[i%num_workers].put(i)\n while any(q.qsize() for q in queues):\n print(\"Waiting...\")\n time.sleep(0.1)\n continue\n print(\"stop.set()\")\n stop.set()\n for wid in range(num_workers):\n print(\"Joining\", wid)\n workers[wid].join()\n \n print(\"Done\")\ndef main():\n if len(sys.argv) \u003e 1 and sys.argv[1] == \"profile\":\n print(\"Profiling with cProfile\")\n with cProfile.Profile() as pr:\n run()\n else:\n print(\"Running without cProfile\")\n run()\nif __name__ == \"__main__\":\n main()\n commented on this paste.```\n\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/andrewkho","@type":"Person","name":"andrewkho"},"datePublished":"2024-10-08T22:56:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/125165/cpython/issues/125165"}
| 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:5afe0439-1bca-4f71-4423-8fc06d6c9276 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 90AA:F487:7521C:938E9:696AD1BB |
| html-safe-nonce | e02e6cca1ce1a754484e0b30cbdc59c50c647bcebaabe11ac3f6f84ac17d40c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MEFBOkY0ODc6NzUyMUM6OTM4RTk6Njk2QUQxQkIiLCJ2aXNpdG9yX2lkIjoiNzQzMzIzNzkyMDI4Mjc1OTYxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2a43ef08f6a373a119e4a417c15387541c84435ac78ae9151f3ee4707e2bc58c |
| hovercard-subject-tag | issue:2574374621 |
| 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/125165/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bef5ff4426c486afa6e16f2cb7f62373a955d516555f005cde368001dfc02ebf/python/cpython/issues/125165 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bef5ff4426c486afa6e16f2cb7f62373a955d516555f005cde368001dfc02ebf/python/cpython/issues/125165 |
| og:image:alt | Bug report Bug description: I'm testing Python 3.13t and trying to run cProfile in a context manager, however it seems to hang and/or segfault. Below script repros the issue. With > python -Xgil=1 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andrewkho |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| 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 | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width