Skip to content

In REPL, if response is created from a blob, then response.arrayBuffer() never resolves #49062

Closed
@UlyssesZh

Description

@UlyssesZh

Version

v20.5.0

Platform

Linux ulysses-legion-r70002021 5.15.0-76-generic #83~20.04.1-Ubuntu SMP Wed Jun 21 20:23:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Run node in command line to enter REPL mode, then run the following:

response = new Response(new Blob([new Uint8Array([5,2,0])]));
await response.arrayBuffer(); // stuck forever

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

The code snippet above reproduces the bug steadily. However, similar codes do not produce the same bug when run them in a script file. Also, strangely, the one-liner does not reproduce the same bug (in REPL):

await new Response(new Blob([new Uint8Array([5,2,0])])).arrayBuffer(); // gets expected result

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

No response

What do you see instead?

Stuck forever.

Additional information

I tried v18 and v20, and I found that the bug is only reproduceable on v20 but not on v18.

Also, there is another bug that I think is related:

// test.mjs
const response = await fetch(URL.createObjectURL(new Blob([new Uint8Array([5,2,0])])));
console.log(await response.arrayBuffer());
node test.mjs

Run this script will crash Node v20 (with exit code 13 and no output). Node v18 runs it fine expectedly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions