-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ws-proxy] fix leak idle connection cache #20857
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR centralizes HTTP transport creation to prevent idle connection leaks by reusing a single transport instance with customizable options.
- Introduce
createDefaultTransport
with variadiccreateHttpTransportOpt
and awithSkipTLSVerify
option. - Replace inline
http.Transport
instantiation in routes with a reusedportTransport
. - Remove direct
tls.Config
setup in favor of the new transport option pattern.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
components/ws-proxy/pkg/proxy/routes.go | Define and reuse portTransport via createDefaultTransport |
components/ws-proxy/pkg/proxy/pass.go | Add createHttpTransportOpt , withSkipTLSVerify , and update transport constructor |
Comments suppressed due to low confidence (5)
components/ws-proxy/pkg/proxy/pass.go:225
- [nitpick] Consider renaming 'withSkipTLSVerify' to 'skipTLSVerifyOpt' or similar to align with the 'XxxOpt' naming convention for option functions.
func withSkipTLSVerify() createHttpTransportOpt {
components/ws-proxy/pkg/proxy/pass.go:233
- There are no unit tests for 'createDefaultTransport' or its options; add tests to verify that 'withSkipTLSVerify' and timeout settings are applied correctly.
func createDefaultTransport(config *TransportConfig, opts ...createHttpTransportOpt) http.RoundTripper {
components/ws-proxy/pkg/proxy/routes.go:534
- [nitpick] The variable name 'portTransport' may be ambiguous; consider renaming to 'wsPortTransport' or 'defaultPortTransport' to clarify its purpose.
portTransport := createDefaultTransport(config.Config.TransportConfig, withSkipTLSVerify())
components/ws-proxy/pkg/proxy/pass.go:41
- The comment has grammatical issues; consider rephrasing to 'createHttpTransportOpt allows composing HTTP transport options.'
// createHttpTransportOpt allows to compose create http Transport options.
components/ws-proxy/pkg/proxy/pass.go:233
- Add a comment describing the parameters of 'createDefaultTransport' and how the variadic options are applied to improve maintainability.
func createDefaultTransport(config *TransportConfig, opts ...createHttpTransportOpt) http.RoundTripper {
👋 @iQQBot I'll take a look right now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM ✔️
Thank you @iQQBot for crushing once again! 🚀 |
/unhold |
Description
[ws-proxy] fix leak idle connection cache
Related Issue(s)
Fixes CLC-1392
How to test
conntrack -L | grep 28832
for observeDocumentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold