Closed
Description
Reproduction:
async function collect(o) {
const buffer = [];
const reader = o.getReader();
while(true){
const { value , done } = await reader.read();
if (done) {
return buffer;
}
buffer.push(value);
}
}
function concat(...os) {
const { writable , readable } = new TransformStream();
(async function() {
for (const o of os){
await o.pipeTo(writable, {
preventClose: true
});
}
writable.getWriter().close();
})();
return readable;
}
const EOF = Symbol();
function external() {
let next;
const observable = new ReadableStream({
start (controller) {
next = (v)=>{
if (v === EOF) {
return controller.close();
}
controller.enqueue(v);
};
}
});
return {
observable,
next: next
};
}
function range(start, end) {
const { observable , next } = external();
const len = Math.abs(end - start);
const dir = Math.sign(end - start);
for(let i = 0; i <= len; i++){
next(start + i * dir);
}
next(EOF);
return observable;
}
async function main() {
const list = collect(concat(range(1, 2)));
console.log(await list, [
1,
2,
3,
4
]);
}
await main();
The isolate crashes with error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise.
at o.pipeTo
call. Looking at the runtime implementation, a deferred promise is created (and returned), that is not resolved (line 1881 in op_crates/fetch/11_stream.js
). This results in a hanging promise, breaking the isolate.
cc @kitsonk