-
Notifications
You must be signed in to change notification settings - Fork 149
chore(guard): clean up guard #4057
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
base: 01-27-fix_fix_active_req_caculation_add_hws_metrics
Are you sure you want to change the base?
chore(guard): clean up guard #4057
Conversation
|
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. |
PR Review: Guard CleanupThis PR represents a significant refactoring of the guard proxy service with substantial code reduction. The changes improve code organization and separation of concerns. Strengths
Critical Issues1. Resource Leak in WebSocket Error Handling (proxy_service.rs:647-655) The code spawns a task to release in-flight counters but does not track completion. If the task panics or system shuts down, counters will not be released, causing resource leaks and potential DoS. Recommendation: Use TaskGroup to spawn this task, OR use a Drop guard for cleanup, OR at minimum log failures. 2. Always Treating Responses as Streaming (proxy_service.rs:737-741) The streaming detection is hardcoded to true. All responses are treated as streaming even for small JSON responses, causing potential memory inefficiency. Recommendation: Implement proper streaming detection OR document why hardcoded OR remove dead code. 3. Silent WebSocket Task Failures (proxy_service.rs:1479-1672) WebSocket custom serve handler spawns tasks that return Result but errors are never logged or handled. Recommendation: Add error logging at minimum. Consider metrics/alerts for task failures. 4. Inconsistent Logging Levels Mixed use of trace/debug/error throughout the file makes debugging difficult. Recommendation: Establish consistent conventions (trace=verbose, debug=lifecycle, warn=retryable, error=fatal). 5. URL Parsing Security (proxy_service.rs:958-992) Manual IPv6 and query string handling could be fragile for edge cases. Recommendation: Add test coverage for IPv6 with ports, special characters in query strings, paths with fragments, multiple delimiters. 6. Code Duplication WebSocket close frame handling is duplicated throughout lines 1500-1660. Recommendation: Extract to helper function. Minor Issues
Performance & Security
RecommendationsMust Fix:
Should Fix: Nice to Have: Overall AssessmentSolid refactoring that improves code organization. Main concerns are resource cleanup guarantees and hardcoded streaming flag. Request changes for critical resource leak issue, then approve after fix. |
8824966 to
d078517
Compare
e4b540a to
93864b6
Compare
d078517 to
30b52ba
Compare

No description provided.