Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4436672
repro_async_generator_crash_stress.cjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
repro_async_generator_crash_stress.cjs
View Options
async function* delayedPair(tag) {
await new Promise((resolve) => setTimeout(resolve, 0));
yield tag + ":one";
await new Promise((resolve) => setTimeout(resolve, 0));
yield tag + ":two";
}
async function stressOverlap(iteration) {
const it = delayedPair("overlap:" + iteration);
const p1 = it.next();
const p2 = it.next();
const p3 = it.next();
return Promise.allSettled([p1, p2, p3]);
}
async function stressReturn(iteration) {
const it = delayedPair("return:" + iteration);
const p1 = it.next();
const p2 = it.return("done:" + iteration);
return Promise.allSettled([p1, p2]);
}
async function stressThrow(iteration) {
const it = delayedPair("throw:" + iteration);
const p1 = it.next();
const p2 = it.throw(new Error("boom:" + iteration));
return Promise.allSettled([p1, p2]);
}
async function main() {
for (let i = 0; i < 512; i++) {
if ((i & 31) === 0) console.log("iter", i);
await stressOverlap(i);
await stressReturn(i);
await stressThrow(i);
}
console.log("async generator crash stress completed");
}
main().catch((err) => {
console.error(err && err.stack ? err.stack : String(err));
throw err;
});
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sat, May 2, 7:01 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
543543
Default Alt Text
repro_async_generator_crash_stress.cjs (1 KB)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment