ssl: store SSL socket owners as weak references - #8423
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSSL socket owners now use weak Python references. Socket and BIO construction propagate weak-reference conversion errors. Owner access upgrades references, and SNI callbacks return ChangesSSL owner lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] lib: cpython/Lib/ssl.py dependencies:
dependent tests: (53 tests)
[x] lib: cpython/Lib/asyncio dependencies:
dependent tests: (7 tests)
Legend:
|
f7e845d to
977c0a4
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/stdlib/src/ssl.rs`:
- Around line 1923-1928: Use a shared owner-conversion helper in
crates/stdlib/src/ssl.rs to treat Python None as absent before creating PyWeak.
Apply it at lines 1923-1928 and 2005-2010, and update the owner assignment at
lines 3983-3986 to clear the owner when given None.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro Plus
Run ID: b182b78d-b8a5-468f-ad72-6194f4a99ef4
⛔ Files ignored due to path filters (2)
Lib/test/test_asyncio/test_ssl.pyis excluded by!Lib/**Lib/test/test_ssl.pyis excluded by!Lib/**
📒 Files selected for processing (1)
crates/stdlib/src/ssl.rs
Assisted-by: Codex:gpt-5.6-sol
977c0a4 to
b3e4f6f
Compare
| session_was_reused: PyMutex<bool>, | ||
| // Owner (SSLSocket instance that owns this _SSLSocket) | ||
| owner: PyRwLock<Option<PyObjectRef>>, | ||
| owner: PyRwLock<Option<PyRef<PyWeak>>>, |
Assisted-by: Codex:gpt-5.6-sol
Summary
test_ssl.test_sni_callback_on_dead_references_SSLSocket.owneras a weak referencetest_create_connection_memory_leakandtest_handshake_timeout_handler_leakSummary by CodeRabbit