CloudFetch and M2M token exchange are unbounded and uninterruptible (v1.13.0)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
まず internal/rows/rows.go、internal/rows/arrowbased/arrowRows.go、batchloader.go のダウンロードパスをたどり、次に auth/oauth/m2m/m2m.go と関連する connector および config のエントリを調べます。既存の CloudFetch と認証のエントリポイントを使って、コンテキスト、クライアント、有効期限、トークンの挙動を理解します。4 つの報告されたパスが、上限があり中断可能な挙動、または明示的に文書化された終端条件を持ち、WithCloudFetch のコメントがデフォルトと一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Version
v1.13.0
Summary
CloudFetch result downloads are unbounded and uninterruptible, and an expired
presigned link ends the read with no recovery path. Four issues, the first three
in the download path and the fourth on the auth path.
1. The caller's context is discarded
internal/rows/rows.go:622 and :624 pass r.ctx into NewArrowRowScanner,
but internal/rows/arrowbased/arrowRows.go:124 substitutes context.Background()
when constructing the iterator:
bi, err2 = NewCloudBatchIterator(context.Background(), rowSet.ResultLinks, ...)
So the context given to QueryContext never reaches the download. Cancelling the
query, or its deadline expiring, cannot stop an in-progress file fetch.
2. The download client has no timeout and no public setter
internal/rows/arrowbased/batchloader.go:62 falls back to http.DefaultClient,
which has no Timeout:
httpClient := http.DefaultClient
if cfg.HTTPClient != nil {
httpClient = cfg.HTTPClient
}
CloudFetchConfig.HTTPClient has no ConnOption. The only way to populate it is
WithTransport, which also replaces the Thrift transport as a side effect, and
the http.Client it builds (connector.go:421) sets no Timeout either.
Related: #307 asked for a configurable CloudFetch transport and was closed as
completed. WithTransport addresses the transport case, but a RoundTripper
cannot set http.Client.Timeout, so the timeout case above is still open.
Together with (1), a stalled download has neither a timeout nor working
cancellation. Because downloads are lazy (cloudIPCStreamIterator.Next(),
batchloader.go:200), the caller is blocked inside row iteration, so a deferred
rows.Close() cannot fire to break the stall.
3. Expired links are terminal
batchloader.go:453 returns errors.New(dbsqlerr.ErrLinkExpired). That constant
appears nowhere else in the module apart from its own definition: nothing handles
it and nothing re-issues links. A result set large enough that its presigned URLs
expire part-way through reading cannot be completed, only restarted.
CloudFetchConfig.MinTimeToExpiry defaults to 0 (internal/config/config.go:557
clamps only negative values) and likewise has no ConnOption, so a caller cannot
widen the safety margin.
4. The token exchange is unbounded and serialized
auth/oauth/m2m/m2m.go:41 holds authClient.mx across the token fetch, and the
token source is built with context.Background() (m2m.go:73), so
clientcredentials falls back to http.DefaultClient with no timeout. A hung
token endpoint therefore stalls every in-flight request on that connector
indefinitely, with no way for the caller to bound it. Endpoint discovery is
capped at 10s (auth/oauth/oauth.go:21), but the exchange itself is not.
Also, a doc mismatch
WithCloudFetch's comment (connector.go:429) says "Default is false", but
CloudFetchConfig.WithDefaults() sets UseCloudFetch = true unconditionally
(internal/config/config.go:546). CloudFetch is on by default.
Suggested fixes
- Pass the scanner's context through to
NewCloudBatchIteratorinstead of
context.Background(). - Expose
HTTPClientandMinTimeToExpiryasConnOptions, so a caller can bound
downloads without displacing the Thrift transport. Note thatWithTransportis
not a substitute: aRoundTrippercannot sethttp.Client.Timeout, so it can
only bound each hop of a redirect chain rather than the request as a whole. - Bound the token exchange, and consider not holding the mutex across it.
- Re-fetch result links on expiry, or if that is out of scope, document the
condition as terminal so callers can plan for it.
- 主要言語
- Go
- スター
- 53
- フォーク
- 66
- 平均マージ
- 16時間 35分
- マージ済み PR(30日)
- 16
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
databricks/databricks-sql-go のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
databricks/databricks-sql-go#476 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 64/100
databricks/databricks-sql-go#490 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
databricks/databricks-sql-go#481 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
databricks/databricks-sql-go#480 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
databricks/databricks-sql-go#474 ·
メンテナーはふだん 1 日以内に返信
databricks/databricks-sql-go の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
siderolabs/terraform-provider-talos#414 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
JuliaComputing/jh#63 · コメント 1 件 ·
-
area/proxy kind/bug priority/backlog triage/accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
lexfrei/cloudflare-tunnel-gateway-controller#840 ·
メンテナーはふだん 1 日以内に返信
-
Priority: Normal Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
cloudflare/cloudflared#1747 ·