ReadableStream cannot be returned through a forwarded stub
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
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript, typescript
Direzione di ricerca
Inizia con RpcPayload.ensureDeepCopied() e getHookForReadableStream, quindi riproduci l’esempio del broker a due sessioni riportato nell’issue. Verifica che un ReadableStream restituito tramite childStub.dup() raggiunga il chiamante senza l’errore owned-payload, mentre il comportamento della sessione diretta rimanga invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A ReadableStream returned by an RPC method works when the caller holds a direct session to the target. It throws when the call is forwarded through an intermediate session, such as when a broker returns a dup of a stub it holds to a third party.
- Create a session between a broker and a child. The child has a method that returns a ReadableStream.
- Create a second session between a caller and the broker. The broker exposes a method that returns
childStub.dup(). - From the caller, resolve that stub and call the stream-returning method on it.
Expected: the caller receives a ReadableStream, the same as it would on a direct session.
Actual: Error: owned payload shouldn't contain raw ReadableStreams.
Cause: RpcPayload.ensureDeepCopied() sets source to "owned" after the first hop. getHookForReadableStream handles "params" and "return" and throws on anything else. Regular stubs forward across the same two sessions without error, so only streams hit this.
import { newMessagePortRpcSession, RpcTarget } from "capnweb";
class Child extends RpcTarget {
async ping() { return "pong"; }
async tail() {
let i = 0;
return new ReadableStream({
pull(c) { if (i >= 3) return c.close(); c.enqueue(new Uint8Array([i++])); }
});
}
}
class Broker extends RpcTarget {
constructor(child) { super(); this.child = child; }
async resolveChild() { return this.child.dup(); }
}
const childChan = new MessageChannel();
newMessagePortRpcSession(childChan.port2, new Child());
const childFromBroker = newMessagePortRpcSession(childChan.port1);
const brokerChan = new MessageChannel();
newMessagePortRpcSession(brokerChan.port2, new Broker(childFromBroker));
const broker = newMessagePortRpcSession(brokerChan.port1);
const child = await broker.resolveChild();
console.log(await child.ping()); // "pong"
await child.tail(); // throws
Tested on capnweb 0.10.0. The same error string is present in 0.8.0.
Workaround: return an RpcTarget with a next() method instead of the stream, and rebuild the stream on the caller side.
- 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 47 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 81 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
VictoriaMetrics/victorialogs-datasource#747 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
bug from-studio
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
esengine/DeepSeek-Reasonix#14608 ·
I maintainer di solito rispondono entro 1 giorno
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
getarcaneapp/arcane#4590 ·
I maintainer di solito rispondono entro 1 giorno
-
支持对已取消(cancelled)任务生成报告Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
Clouditera/VulnHunter#57 ·