Skip to content
Commit Detail

Commit ad66272

Author
Luís Duarte <lduarte@cloudflare.com> 2026-02-13 11:12:47 +0000
Parents
dd7a515
Tree
b85436d
fix: properly cleanup setTimeout when `scheduler.wait` gets aborted

Even though `scheduler.wait` can be passed an `AbortSignal`, when this
signal is actioned it doesn't seem to properly cleanup the setTimeout.
This is most troubling when the aborted `scheduler.wait` has to wait for
a good while, because that `setTimeout` slot will probably never be
freed up.

The repro test emulates 11k setTimeouts being aborted - and before that
would fail with:

```
workerd/io/worker.c++:2324: info: uncaught exception; source = Uncaught (in promise); stack = QuotaExceededError: You have exceeded the number of active timeouts you may set. max active timeouts: 10000, current active timeouts: 10000, finished timeouts: 0
```

And now it passes because it correctly cancels the setTimeout.

Files changed

2 files changed~2 modified