-
Notifications
You must be signed in to change notification settings - Fork 142
fix(ups): fix memory leak with local subscribers #3752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ups): fix memory leak with local subscribers #3752
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Pull Request Review: Fix Memory Leak with Local SubscribersOverviewThis PR addresses a memory leak in the UniversalPubSub (UPS) system by replacing ✅ Strengths
🔍 Potential Issues & SuggestionsCritical: Race Condition in Subscriber::DropLocation: The Scenario:
Recommendation:
Performance: Redundant Metric UpdatesLocation: Multiple files Metrics are updated on every HashMap operation. Recommendation:
Code Quality: Inconsistent Error HandlingLocation: Send failures are silently ignored. While closed channels are cleaned up by GC, this makes debugging difficult. Recommendation: Add debug logging for send failures Postgres Driver: Potential Memory Leak in Cleanup TaskLocation: If Scenario:
Recommendation: Restructure to ensure cleanup happens when receiver_count reaches 0 Documentation: Missing Safety CommentsThe weak reference pattern in GC tasks is critical for preventing memory leaks but isn't documented. Add comments explaining why weak references are needed. Testing: No Test CoverageThe PR doesn't include tests for the memory leak fix. Recommendation: Add tests that verify:
Minor: UniversalDB Metrics RenameThe rename from 🔒 Security ConsiderationsNo security concerns identified. 📊 Performance ConsiderationsPositive:
Concerns:
🎯 Overall AssessmentThis is a solid fix for a critical memory leak issue. The migration to lock-free data structures is the right approach. However, address these issues before merging:
📋 Checklist
Overall: Approve with requested changes - The core fix is sound, but address the race condition and consider the performance optimizations. |
More templates
@rivetkit/cloudflare-workers
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
4c35dd1 to
634f682
Compare
cb04567 to
39100b1
Compare
634f682 to
271abff
Compare
Merge activity
|
PR Review: Fix Memory Leak with Local Subscribers (UPDATED)This PR addresses a memory leak in universalpubsub by replacing std::collections::HashMap with scc::HashMap and implementing proper garbage collection. Strengths
Critical Issues
Code Quality
Recommendations
Impact
Verdict✅ Approve with minor suggestions - Solid fix with appropriate solution. Metrics will help monitor in prod. Great work fixing this leak! |

No description provided.