Title: Drop replaced tracing callbacks outside locks by youknowdot · Pull Request #9612 · RustPython/RustPython · GitHub
Open Graph Title: Drop replaced tracing callbacks outside locks by youknowdot · Pull Request #9612 · RustPython/RustPython
X Title: Drop replaced tracing callbacks outside locks by youknowdot · Pull Request #9612 · RustPython/RustPython
Description: Summary Retain replaced trace and profile callbacks until the current-thread or all-thread updates are complete and the associated locks and VM borrows are released. A callback's finalizer can reenter these APIs; dropping a last reference while holding a callback or thread-registry mutex can otherwise deadlock. For all-thread setters, reserve storage for the old slot callbacks before changing global or slot state. On allocation failure, release the registry lock before constructing MemoryError and leave tracing state unchanged. The lock order follows the existing thread-slot initialization path. Validation Independently source-reviewed for current/all-thread state ordering, callback ownership, reentrancy, unwind and allocation-failure handling, lock order, threading/nonthreading configurations, and CPython 3.15's deferred old-callback decrefs. prek run --files crates/vm/src/stdlib/sys.rs, normal commit hooks, and git diff --check passed. Native RustPython compilation and execution were not run locally; hosted CI is required. Existing test_threading cases cover normal all-thread trace/profile updates, but no existing test identified directly covers finalizer reentry. Scope This is a narrow callback-lifetime fix. Existing all-thread dispatch and stop-the-world differences from CPython remain outside this change. No Lib or test files were modified.
Open Graph Description: Summary Retain replaced trace and profile callbacks until the current-thread or all-thread updates are complete and the associated locks and VM borrows are released. A callback's finalizer can ...
X Description: Summary Retain replaced trace and profile callbacks until the current-thread or all-thread updates are complete and the associated locks and VM borrows are released. A callback's finalizer ...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9612
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:61173f8e-feb7-bfb5-6129-3438a5000320 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C110:97D39:D72309:11C122B:6B01FE7E |
| html-safe-nonce | 96eba8f880f277bfadfbb396f952ebd47c87123a65d57cf44c4bfce4b891b8c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTEwOjk3RDM5OkQ3MjMwOToxMUMxMjJCOjZCMDFGRTdFIiwidmlzaXRvcl9pZCI6IjM2MjUyNjI1NTYzODc2MDYxNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 18cb2ad154e6057760fe3ddc22e89f7797888f19db0c622c4e9e09d8c2d07f0b |
| hovercard-subject-tag | pull_request:5137390504 |
| 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/RustPython/RustPython/pull/9612/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Retain replaced trace and profile callbacks until the current-thread or all-thread updates are complete and the associated locks and VM borrows are released. A callback's finalizer can ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width