Title: Release SQLite callbacks and expanded trace SQL safely by 1ndahous3 · Pull Request #9151 · RustPython/RustPython · GitHub
Open Graph Title: Release SQLite callbacks and expanded trace SQL safely by 1ndahous3 · Pull Request #9151 · RustPython/RustPython
X Title: Release SQLite callbacks and expanded trace SQL safely by 1ndahous3 · Pull Request #9151 · RustPython/RustPython
Description: This PR follows our AI policy Summary Release replaced and disabled trace, progress, and authorizer callbacks, and clear their registrations when a connection closes or is reinitialized. Keep active callbacks alive through invocation and result conversion, releasing Python references after native and Rust locks. Preserve deferred rollback and reject registrations against an already closed native connection. Dispose of old callbacks before publishing a replacement connection, including databases installed by reentrant finalizers. Drain deferred cleanup after BLOB operations and native handle disposal. Keep each BLOB attached to its original database across connection reinitialization. Free the SQL text allocated by SQLite for each trace callback, also addressed in the larger draft #8944. Memory usage Windows 11 x64 Workload Before After Private-memory growth over 20,000 traced queries with a 1 KiB parameter, after warmup 21.8 MiB 64 KiB Retained callback payload after 256 registrations and close, 64 KiB per callback 16 MiB 0 Known limitations When __init__() is called from an active native callback, Python finalizers remain deferred until the enclosing native operation returns. This avoids running destructors under SQLite locks, but their timing can differ from CPython and they may observe the replacement connection. AI assistance Written with Codex (GPT-6), reviewed by a human before submission. Summary by CodeRabbit Bug Fixes Improved SQLite callback reliability when callbacks are replaced, cleared, or the connection is closed. Fixed cleanup when callbacks unregister themselves or interact with the connection during release. Improved connection reinitialization and cleanup during overlapping operations, including restoring default row and text handling. Fixed cases where closing a BLOB could interfere with cursor activity, and improved BLOB operations during connection closure. Tests Added regression coverage for callback lifetimes, concurrent cleanup, BLOB closure during cursor activity, and connection usability after reinitialization.
Open Graph Description: This PR follows our AI policy Summary Release replaced and disabled trace, progress, and authorizer callbacks, and clear their registrations when a connection closes or is reinitialized. Keep act...
X Description: This PR follows our AI policy Summary Release replaced and disabled trace, progress, and authorizer callbacks, and clear their registrations when a connection closes or is reinitialized. Keep act...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9151
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:78d47878-12ae-08b6-7368-9d6a752294e8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E004:6365:31B7BE5:425D1B8:6B01F376 |
| html-safe-nonce | 86defc1319d651e39f6fe2884c9895c493b4c958c6db1ca2efae386a44ab8ed4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDA0OjYzNjU6MzFCN0JFNTo0MjVEMUI4OjZCMDFGMzc2IiwidmlzaXRvcl9pZCI6IjQzNTg3ODU2NTQyMDU4MzgxOTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cd1f353f1d2be9e874f7d5a4ad2afbe2a4c876f44f167dba9800e514d59ef3b4 |
| hovercard-subject-tag | pull_request:4872580418 |
| 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/9151/files |
| twitter:image | https://avatars.githubusercontent.com/u/9205230?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/9205230?s=400&v=4 |
| og:image:alt | This PR follows our AI policy Summary Release replaced and disabled trace, progress, and authorizer callbacks, and clear their registrations when a connection closes or is reinitialized. Keep act... |
| 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 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width