`exportStub()` always allocates a new export ID, even for duplicate capabilities
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- api, distributed-systems
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 4k
- Forks
- 150
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cloudflare/capnweb
-
`getImport()` returns the id of an already-settled import, sending a released id to the peerPosiblemente ocupada @Kanishkrawatt la tomó hace 45 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
cloudflare/capnweb#265 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
cloudflare/capnweb#269 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
cloudflare/capnweb#260 ·
Los mantenedores suelen responder en 1 día
-
onRpcBroken should return a Disposable so registrations can be undoneQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
cloudflare/capnweb#234 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
support `Map` serialization typePosiblemente ocupada @srikrsna la tomó hace 80 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
cloudflare/capnweb#230 ·
Los mantenedores suelen responder en 1 día
Todos los issues de cloudflare/capnweb
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
cline/cline#15327 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
LogicLabs-OU/OpenArchiver#509 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
bigcapitalhq/bigcapital#1545 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día