`exportStub()` always allocates a new export ID, even for duplicate capabilities
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- api, distributed-systems
Direzione di ricerca
Trace exportStub() in src/rpc.ts and the devaluateHook, getHookForRpcTarget(), and getHookForWritableStream() paths in src/serialize.ts. Compare hook duplication with reverseExports and the intentional non-deduplication in exportPromise. Done should ensure repeated exportable capabilities can reuse export IDs without changing promise behavior or reintroducing the remoteRefcount issue in #140.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
exportStub() deduplication by hook identity never fires.
reverseExports is a Map<StubHook, ExportId>, so dedup is by object identity.
devaluateHook routes to either exportStub or exportPromise depending on whether the type is "export"/"writable" or "promise". The promise path is intentionally never deduplicated (exportPromise comment: "Promises always use a new ID because otherwise the recipient could miss the resolution."), so the issue only concerns the paths that reach exportStub:
"stub"/"rpc-promise" https://github.com/cloudflare/capnweb/blob/c2bb17b940b23eb8ab89be1e85538493cb4552ad/src/serialize.ts#L218-L224 hook is set to the result of hook.dup() if pathIfPromise is falsy (the only time exportStub will be called).
"function"/"rpc-target" https://github.com/cloudflare/capnweb/blob/c2bb17b940b23eb8ab89be1e85538493cb4552ad/src/serialize.ts#L233-L234
getHookForRpcTarget() returns hook.dup() for "return" payloads (after correctly deduplicating in rpcTargets by target object identity), or a fresh TargetStubHook.create() each time for "params" payloads. Either way, a fresh object reaches exportStub.
"writable" https://github.com/cloudflare/capnweb/blob/c2bb17b940b23eb8ab89be1e85538493cb4552ad/src/serialize.ts#L251-L252
getHookForWritableStream() uses identical logic to getHookForRpcTarget() for our purposes, it deduplicates in rpcTargets for "return" payloads but returns hook.dup() each time, fresh WritableStreamStubHook each time for "params".
In all three cases, dup() always returns a new object for every hook type that can be exported (RpcImportHook, TargetStubHook, WritableStreamStubHook, ReadableStreamStubHook, PayloadStubHook). The two types where dup() returns this (ErrorStubHook and MapVariableHook) are never exported.
Because the stub fed to exportStub is always a newly created object, it will never be found in reverseExports, so we will always create a new export.
This means the same capability appearing twice always gets separate export IDs. This is what prevents the remoteRefcount bug (#140) from being triggered currently
- Lingua principale
- TypeScript
- Stelle
- 4k
- Fork
- 150
- Merge medio
- 1g 19h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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/capnweb
-
`getImport()` returns the id of an already-settled import, sending a released id to the peerForse già presa @Kanishkrawatt l’ha presa 46 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cloudflare/capnweb#265 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
cloudflare/capnweb#269 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
cloudflare/capnweb#260 ·
I maintainer di solito rispondono entro 1 giorno
-
onRpcBroken should return a Disposable so registrations can be undoneForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cloudflare/capnweb#234 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
support `Map` serialization typeForse già presa @srikrsna l’ha presa 80 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
cloudflare/capnweb#230 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cloudflare/capnweb
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
grafana/profiles-drilldown#1212 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
grafana/traces-drilldown#980 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
openremote/openremote#3487 · 1 commento ·
-
triage:needs-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
garrytan/gbrain#7635 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
coollabsio/jean#867 ·
I maintainer di solito rispondono entro 1 giorno