AbortSignal is ignored while waiting for retry backoff
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- typescript
- 領域
- api
調査の方向性
src/core.ts:595-630 の retryRequest() から始め、makeRequest() が options.signal をどのように処理しているかを追跡します。提供された再現手順を確認します。500 ms の再試行遅延中に中止すると APIUserAbortError ですぐに reject され、通常の再試行動作が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
Aborting a request while it is waiting to retry does not interrupt the retry delay. The SDK waits for the full Retry-After/backoff period before it notices the signal is aborted.
retryRequest() uses an unconditional await sleep(timeoutMillis) at src/core.ts:595-630. The caller's options.signal is only checked when makeRequest() starts the next attempt.
Reproduction
import Browserbase from '@browserbasehq/sdk';
let attempts = 0;
const client = new Browserbase({
apiKey: 'test',
maxRetries: 1,
fetch: async () => {
attempts++;
return new Response('{}', {
status: attempts === 1 ? 429 : 200,
headers: {
'content-type': 'application/json',
'retry-after-ms': '500',
},
});
},
});
const controller = new AbortController();
const started = Date.now();
const request = client.get('/retry', { signal: controller.signal });
setTimeout(() => controller.abort(), 20);
await request.catch((error) => {
console.log(error.constructor.name); // APIUserAbortError
console.log(Date.now() - started); // ~500 ms, not ~20 ms
});
Expected behavior
The retry wait is abortable, so the promise rejects with APIUserAbortError promptly after about 20 ms.
Actual behavior
The promise does not reject until the complete 500 ms retry delay has elapsed. A long server-provided Retry-After value makes cancellation ineffective for that entire period.
Why this matters
Abort signals are used to release work when requests, jobs, or incoming HTTP connections are canceled. Keeping canceled operations pending through retry delays wastes resources and makes shutdown/cancellation latency unpredictable. The delay should race against the signal and clean up its listener/timer on either outcome.
Tested against @browserbasehq/sdk 2.18.0 / current main (b781bd7).
- 主要言語
- TypeScript
- スター
- 64
- フォーク
- 17
- 平均マージ
- 13分
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
browserbase/sdk-node のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
browserbase/sdk-node#202 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
browserbase/sdk-node#197 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
browserbase/sdk-node#193 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
browserbase/sdk-node#180 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 66/100
browserbase/sdk-node#218 · コメント 2 件 ·
browserbase/sdk-node の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
TanStack/tanstack.com#1293 ·