Repository navigation
feat: time out stalled requests, stop collapsing 5xx into FAILED - #10
Merged
Merged
Conversation
Both weaknesses were written down in the private deployment repo's notes as things to raise upstream, and never were. They matter most to a share behind a tunnel, which is the setup those notes describe. No request had a deadline. When a tunnel or proxy stops answering, fetch never settles and the Files app waits forever — ChromeOS gives the user no way to cancel an FSP request. Metadata now gets 30s and body reads 120s, the longer budget so a slow link isn't cut off. The deadline is renewed per attempt rather than per call. AccessAuth retries internally after a login that can take 90 seconds, so a single deadline spanning the login would guarantee the retry aborts. DavClient passes both a signal and the budget: the signal covers a plain fetch, and an auth wrapper that retries re-arms from the budget. Separately, 502/503/504 had no branch in the error mapping and fell through to FAILED, alongside genuine bugs and misconfiguration. They now map to IO, as do timeouts. 501 keeps INVALID_OPERATION — "method not implemented" is not a broken path. toProviderError moves to errors.js so it can be tested at all; it was the only logic in background.js, which imports chrome and cannot be loaded under node. Also chmod the test tree in make-tree.sh. compat.sh defaults DAV_SHARE_PATH to mktemp -d, which is 0700, and Apache runs as another uid inside its container — so the default invocation failed with 403 on two of the seven servers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
非公開の運用リポジトリ側のメモに「移行後も残る弱点 (上流に起票する)」として書かれたまま、起票されていなかった 2 件。どちらもトンネル越しの共有で刺さる話で、まさにその構成が当事者。
1. どのリクエストにも期限が無かった
トンネルやプロキシが応答を返さなくなると
fetchが解決せず、Files アプリが無限に待つ。ChromeOS 側に FSP のリクエストを中断する手段は無いので、ユーザにできることが何も無い状態になる。メタデータ (PROPFIND) を 30 秒、本体の読み出しを 120 秒で打ち切るようにした。読み出し側を長く取っているのは、遅い回線を弾かないため。
期限は呼び出しごとではなく試行ごとに張り直す。
AccessAuthは失効を検知すると最大 90 秒のログインを挟んで内部で再試行するので、ログイン待ちを跨いで同じ期限を使い回すと再試行が必ず中断される。DavClientは signal と予算の両方を渡し、素の fetch を渡された場合は signal が効き、内部で再試行する auth 実装は予算から張り直す。この張り直しが無いと落ちる回帰テストを入れてある(外すと実際に落ちることを確認済み)。
2. 5xx が FAILED に潰れていた
502/503/504 に分岐が無く、拡張のバグや設定ミスと同じ
FAILEDになっていた。「トンネルが落ちている」「認証が違う」「拡張が壊れている」がユーザから区別できない。5xx とタイムアウトを
IOに写像した。501 はINVALID_OPERATIONのまま — 「そのメソッドを実装していない」であって経路の障害ではないので、5xx の分岐より先に評価している。toProviderErrorをerrors.jsに切り出した。background.jsは chrome を import するので node から読めず、この写像はこれまで一度もテストできていなかった。今回変えるのがまさにそこなので先に出した。ついでに直したハーネスのバグ
compat.shはDAV_SHARE_PATHの既定値をmktemp -dにしていたが、これは 0700。Apache はコンテナ内で別 uid で動くのでツリーを辿れず、既定の呼び出し方だと 7 台中 2 台が 403 で落ちる。make-tree.shでchmod -R a+rXするようにした。実際に踏んで気づいた。確認
🤖 Generated with Claude Code