fix(provider/selfhosted): defer local connection dial until visitor request arrives
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- go
- 領域
- backend, networking
調査の方向性
Read internal/provider/selfhosted.go, especially proxyRequest, and trace how standby tunnel connections receive visitor data. Start by checking how the tunnel connection is read and how local dialing is currently triggered; add a unit test that keeps a standby connection idle and verifies no local socket is opened. Done when local dialing waits for visitor request data and the test passes.
索引モデルが issue の本文から書いたものです。
説明
Description
In internal/provider/selfhosted.go (proxyRequest), when a standby data socket is established with the server, the client immediately dials localhost:localPort before any public visitor has requested the URL:
func (s *SelfHosted) proxyRequest(ctx context.Context, tunnelConn net.Conn, localPort int) {
defer tunnelConn.Close()
localAddr := fmt.Sprintf("localhost:%d", localPort)
var dialer net.Dialer
localConn, err := dialer.DialContext(ctx, "tcp", localAddr) // <--- connects immediately!
Problem & Impact
- Premature Local Connection: If the standby pool maintains 10 pre-warmed sockets to the VPS, 10 idle connections are immediately opened to the user's local application (e.g.
localhost:3000). - Stale Connection Failures: Many local development servers (e.g., Node/Express, Go
http.Server.ReadTimeout, Python dev servers) close idle keep-alive connections after a few seconds of silence. If the connection sits idle onlocalhostwaiting for a visitor, the local server closes it. When a visitor finally arrives through the VPS, the proxy attempts to forward bytes over a dead local socket, resulting in an immediate broken pipe and a 502 Bad Gateway response.
Proposed Solution
Defer connecting to localhost:localPort until the first byte(s) of the HTTP request actually arrive over tunnelConn, or peek/read before dialing localhost.
Acceptance Criteria
- Do not hold open idle connections to
localhostbefore visitor traffic arrives. - Ensure local connection is dialed just-in-time when visitor request data is received.
- Add unit test verifying that idle standby connections do not exhaust local server sockets.
- 主要言語
- Go
- スター
- 9
- フォーク
- 1
- 平均マージ
- 5時間 57分
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
kernelshard/expose のほかの issue
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
kernelshard/expose#71 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
kernelshard/expose#62 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
kernelshard/expose#58 ·
メンテナーはふだん 1 日以内に返信
-
fix(server): add read deadline and size limit to control plane handshake対応中かも @kernelshard が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
kernelshard/expose#56 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
kernelshard/expose#35 ·
メンテナーはふだん 1 日以内に返信
kernelshard/expose の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 81/100
apache/rocketmq-dashboard#6895 ·
メンテナーはふだん 3 日以内に返信
-
agent-butler-finding chore
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
jordansmall/spindrift#5466 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 87/100
777genius/agent-notifications#490 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
devantler-tech/ksail#7836 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
keyxmakerx/Chronicle#1469 ·
メンテナーはふだん 1 日以内に返信