[miniflare] A Durable Object that calls a local Artifacts binding cannot be evicted
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
Direzione di ricerca
Start with packages/miniflare/src/workers/artifacts/wrapped-binding.worker.ts and compare its result handling with the reproduction linked in the issue. Check the Artifacts specs and the reproduction’s eviction test, which calls evictDurableObject(stub) after list(). Done means a disposed list() result no longer prevents eviction; the issue reports that a fix also needs to handle file results and failed get calls.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What versions & operating system are you using?
miniflare5.20261117.0-betaworkerd1.20261117.1@cloudflare/vitest-plugin1.8.3wrangler4.163.0vitest5.1.0- Node v26.10.0, pnpm 12.7.0, Git 2.43.0
- Linux x64 for the reproduction. I first saw the same timeout in a larger project on macOS.
Please provide a link to a minimal reproduction
https://github.com/nodnarbnitram/miniflare-artifacts-evict-repro
Describe the Bug
After a Durable Object calls a method of a local Artifacts binding, the object can no longer be evicted, even when it disposes the result of the call. In a test with @cloudflare/vitest-plugin, await evictDurableObject(stub) never settles, and the test times out. The same code is evicted on miniflare 5.20261109.0-beta.
Steps (the reproduction does exactly this):
- A Worker has an
artifactsbinding withoutremote, and a Durable Object. - A method of the Durable Object runs
const result = await this.env.ARTIFACTS.list(); result[Symbol.dispose]?.();. - A test calls that method on a stub, then
await evictDurableObject(stub).
What happens, with three tests that each call one method and then evict the object:
miniflare |
A: no Artifacts call | B: list(), result disposed |
C: list(), result not disposed |
|---|---|---|---|
| 5.20261117.0-beta | passes | times out | times out |
5.20261109.0-beta (with workerd 1.20261109.1) |
passes | passes | times out |
What I expect: test B passes on 5.20261117.0-beta, as it does on 5.20261109.0-beta. A caller that disposes its results can be evicted.
Cause, as far as I can tell: since #16771 a local Artifacts binding is a wrapped binding. packages/miniflare/src/workers/artifacts/wrapped-binding.worker.ts reads each RPC result of the namespace service with unwrap(...) and returns only the value, so the caller has nothing to dispose, and the wrapper never disposes the result itself. The one result that it does dispose is a get that succeeds, when the caller disposes the repository handle. A get that fails throws inside unwrap before a disposer is set. The wrapper runs in the caller's isolate (its header comment says so), so the results that are never disposed belong to the Durable Object that made the call.
A fix that works for me: in the wrapper, dispose each result after its value is read (a file result only after its body is read), and dispose a failed get before the error is thrown. With that change, all three tests of the reproduction pass on 5.20261117.0-beta, and the Artifacts specs of Miniflare still pass (130 passed, 1 skipped). I have the change ready with a unit spec and a changeset. I am not a registered collaborator, so I have not opened a pull request; I can open one if you want it. The branch: https://github.com/nodnarbnitram/workers-sdk/tree/fix-artifacts-wrapper-dispose (diff against main).
Please provide any relevant error logs
miniflare 5.20261117.0-beta:
✓ A: evicts a Durable Object that did not call Artifacts 9ms
× B: evicts a Durable Object that called Artifacts and disposed the result 10005ms
× C: evicts a Durable Object that called Artifacts 10002ms
Error: Test timed out in 10000ms.
Test Files 1 failed (1)
Tests 2 failed | 1 passed (3)
miniflare 5.20261109.0-beta with workerd 1.20261109.1:
✓ A: evicts a Durable Object that did not call Artifacts 8ms
✓ B: evicts a Durable Object that called Artifacts and disposed the result 8ms
× C: evicts a Durable Object that called Artifacts 10005ms
Test Files 1 failed (1)
Tests 1 failed | 2 passed (3)
miniflare 5.20261117.0-beta with the fixed wrapper file in place of the installed one:
✓ test/evict.spec.ts (3 tests) 19ms
Test Files 1 passed (1)
Tests 3 passed (3)
- Lingua principale
- TypeScript
- Stelle
- 4.7k
- Fork
- 1.7k
- Merge medio
- 1g 22h
- PR unite (30g)
- 282
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudflare/workers-sdk
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
cloudflare/workers-sdk#17215 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
cloudflare/workers-sdk#17189 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cloudflare/workers-sdk#17187 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
cloudflare/workers-sdk#17175 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloudflare/workers-sdk#17174 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cloudflare/workers-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
earendil-works/pi#12615 ·
I maintainer di solito rispondono entro 1 giorno
-
My Caps shows "Shared" on private Caps that were never sharedForse già presa @AksharP5 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
CapSoftware/Cap#4569 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
OHDSI/Data2Evidence#3749 ·
I maintainer di solito rispondono entro 4 giorni
-
PWA: Unique Page TitlesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Flagsmith/flagsmith-nodejs-client#332 ·
I maintainer di solito rispondono entro 2 giorni