Title: Race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts · Issue #114944 · python/cpython · GitHub
Open Graph Title: Race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts · Issue #114944 · python/cpython
X Title: Race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts · Issue #114944 · python/cpython
Description: Bug report Bug description: There is a potential race when _PyParkingLot_UnparkAll is executing in one thread and another thread is unblocked because of an interrupt in _PyParkingLot_Park. Consider the following scenario: Thread T0 is bl...
Open Graph Description: Bug report Bug description: There is a potential race when _PyParkingLot_UnparkAll is executing in one thread and another thread is unblocked because of an interrupt in _PyParkingLot_Park. Consider...
X Description: Bug report Bug description: There is a potential race when _PyParkingLot_UnparkAll is executing in one thread and another thread is unblocked because of an interrupt in _PyParkingLot_Park. Consider...
Opengraph URL: https://github.com/python/cpython/issues/114944
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts","articleBody":"# Bug report\n\n### Bug description:\n\nThere is a potential race when `_PyParkingLot_UnparkAll` is executing in one thread and another thread is unblocked because of an interrupt in `_PyParkingLot_Park`. Consider the following scenario:\n\n1. Thread T0 is [blocked](https://github.com/python/cpython/blob/f35c7c070ca6b49c5d6a97be34e6c02f828f5873/Python/parking_lot.c#L303) in `_PyParkingLot_Park` on address `A`.\n2. Thread T1 executes `_PyParkingLot_UnparkAll` on address `A`. It finds the `wait_entry` for `T0` and [unlinks](https://github.com/python/cpython/blob/f35c7c070ca6b49c5d6a97be34e6c02f828f5873/Python/parking_lot.c#L369) its list node.\n3. Immediately after (2), T0 is woken up due to an interrupt. It then segfaults trying to [unlink](https://github.com/python/cpython/blob/f35c7c070ca6b49c5d6a97be34e6c02f828f5873/Python/parking_lot.c#L320) the node that was previously unlinked in (2).\n\nI haven't attempted to write a minimal repro for this. It occurs reliably on MacOS on [this PR](https://github.com/python/cpython/pull/114839) when running `./python.exe -m test test_asyncio.test_events --match test_get_event_loop_new_process`.\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-114945\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/mpage","@type":"Person","name":"mpage"},"datePublished":"2024-02-03T01:44:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/114944/cpython/issues/114944"}
| 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:a544c7a0-aaad-7466-f89d-8785db754725 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE78:378262:759C4C:9A8724:696AECCB |
| html-safe-nonce | 6b624170044d864b345ea9303da0443b225e72add30a8dacde5d204f613bd6d7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTc4OjM3ODI2Mjo3NTlDNEM6OUE4NzI0OjY5NkFFQ0NCIiwidmlzaXRvcl9pZCI6IjI1NzA4Mjk5NTkxNjg2MDYyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 05984062bc3cea0072534e26fba935f75be30b04e99a7976bd5118449b69613c |
| hovercard-subject-tag | issue:2116113510 |
| 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/114944/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fc894f12689a364290c1d08e7f9645937e21d950090f0544cd0734cf7fa0399c/python/cpython/issues/114944 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fc894f12689a364290c1d08e7f9645937e21d950090f0544cd0734cf7fa0399c/python/cpython/issues/114944 |
| og:image:alt | Bug report Bug description: There is a potential race when _PyParkingLot_UnparkAll is executing in one thread and another thread is unblocked because of an interrupt in _PyParkingLot_Park. Consider... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mpage |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width