Skip to content

Awaiting a Promise between creating a stream and consuming a stream causes Node to crash with code 13 #48668

Closed
@penalosa

Description

@penalosa

Version

v20.4.0

Platform

Darwin 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64 arm Darwin

Subsystem

No response

What steps will reproduce the bug?

Run:

import { Blob } from "node:buffer";

const stream = new Blob(["Hello world"]).stream();

await Promise.resolve();

await stream.pipeTo(new WritableStream());
console.log("Done");

with node. The process will exit with code 13

How often does it reproduce? Is there a required condition?

Always reproduces when the line await Promise.resolve(); is included (or awaiting any promise). If that line is commented out the program prints "Done"

What is the expected behavior? Why is that the expected behavior?

I expect the sample program to run to completion and print "Done", as it does in node v20.3.1

What do you see instead?

Node exiting with code 13:

> node sample.mjs

> echo $?
13

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    promisesIssues and PRs related to ECMAScript promises.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions