AbortSignal timeout is ignored for loaded workers
lemeb opened ·
Hi!
It seems like aborts are ignored for loaded workers. This is problematic because we have no way to stop a call of a loaded worker that hangs.
Repro (v0.6.1, `celld dev`). Put both files in `./proj`, run `celld dev proj --port 8789`, then `curl http://127.0.0.1:8789/`.
<details> `wrangler.jsonc`:
```jsonc { "name": "loader-signal", "main": "index.js", "compatibility_date": "2026-01-01", "worker_loaders": [{ "binding": "LOADER" }] } ```
`index.js`:
```js const CHILD = `export default { async fetch() { await new Promise((resolve) => setTimeout(resolve, 10000)); return new Response('child finished'); } };`;
export default { async fetch(request, env) { const worker = env.LOADER.load({ compatibilityDate: '2026-01-01', mainModule: 'index.js', modules: { 'index.js': CHILD }, globalOutbound: null, }); const t0 = Date.now(); try { const res = await worker.getEntrypoint().fetch('http://child/', { signal: AbortSignal.timeout(1000) }); return new Response(`resolved after ${Date.now() - t0} ms: ${await res.text()}\n`); } catch (error) { return new Response(`rejected after ${Date.now() - t0} ms: ${error}\n`); } }, }; ``` </details>
bartlomiejureferenced 655ff6caf8b6last month on GitHub
bartlomiejureferenced 90b43017241flast month on GitHub
- BA
Fixed in v0.6.2: a fetch to a loaded Worker honors the caller's `AbortSignal`, including `AbortSignal.timeout()`.