Title: gh-115832: Fix instrumentation version mismatch during interpreter shutdown by swtaarrs · Pull Request #115856 · python/cpython · GitHub
Open Graph Title: gh-115832: Fix instrumentation version mismatch during interpreter shutdown by swtaarrs · Pull Request #115856 · python/cpython
X Title: gh-115832: Fix instrumentation version mismatch during interpreter shutdown by swtaarrs · Pull Request #115856 · python/cpython
Description: In 0749244d13412d, I introduced a bug to interpreter_clear(): it sets interp->ceval.instrumentation_version to 0, without making the corresponding change to tstate->eval_breaker (which holds a thread-local copy of the version). After this happens, Python code can still run due to object finalizers during a GC, and this version check in bytecodes.c will see a different result than this one in instrumentation.c, causing an infinite loop. The fix itself is straightforward, and is what I should've done in interpreter_clear() in the first place: also clear tstate->eval_breaker when clearing interp->ceval.instrumentation_version. I also restored a comment that I'm not sure why I deleted in the original commit. To make bugs of this type less likely in the future, I changed instrumentation.c:global_version() to read the version from a PyThreadState* rather than a PyInterpreterState*, so it's reading the version from the same location as the interpreter loop. This had some fan-out effects on its transitive callers, although most of them already had the current tstate available. Issue: gh-115832
Open Graph Description: In 0749244d13412d, I introduced a bug to interpreter_clear(): it sets interp->ceval.instrumentation_version to 0, without making the corresponding change to tstate->eval_breaker (which holds ...
X Description: In 0749244d13412d, I introduced a bug to interpreter_clear(): it sets interp->ceval.instrumentation_version to 0, without making the corresponding change to tstate->eval_breaker (whic...
Opengraph URL: https://github.com/python/cpython/pull/115856
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:fdd850fe-9e07-0733-a459-810698c14f84 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A76C:198E4:3929757:517FDFD:6A569800 |
| html-safe-nonce | cef4b84f136db545b1ab6101dddc1133e49b3f1a026a01bc9b541deee5d1d1f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzZDOjE5OEU0OjM5Mjk3NTc6NTE3RkRGRDo2QTU2OTgwMCIsInZpc2l0b3JfaWQiOiIyMzc3NDk3MDI4NDMzNzEzMTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4e5906821f9b9a2419b0d1981f3b9109a9247f74f0bee7f1d0f2ee1864f03d89 |
| hovercard-subject-tag | pull_request:1740972530 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/115856/files |
| twitter:image | https://avatars.githubusercontent.com/u/118219?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/118219?s=400&v=4 |
| og:image:alt | In 0749244d13412d, I introduced a bug to interpreter_clear(): it sets interp->ceval.instrumentation_version to 0, without making the corresponding change to tstate->eval_breaker (which holds ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 647a25f437e2f54eccdd162bd007c8ae70f4235c4125dba0f4518747cc8b9615 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 05adb86a60ce3d701e556eded3ab26300ec6bcc4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width