Skip to content

CompressionStream hangs #51728

@davewasmer

Description

@davewasmer

Version

v21.6.1

Platform

Darwin ****** 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64 x86_64

Subsystem

globals, streams/web

What steps will reproduce the bug?

function from(src) {
  return new ReadableStream({
    start(controller) {
      controller.enqueue(src);
      controller.close();
    },
  });
}

async function read(stream) {
  const reader = stream.getReader();
  const chunks = [];
  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    chunks.push(value);
  }
  return chunks;
}

await read(from(new ArrayBuffer([0, 0, 0, 0])).pipeThrough(new CompressionStream('gzip')));

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

Every time

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

Should resolve to [Uint8Array(10), Uint8Array(10)].

What do you see instead?

Nothing - reader.read() hangs and never resolves.

Additional information

Running the code snippet in Chrome devtools console produces the correct outcome. Using 'deflate' rather than 'gzip' has no effect, it still hangs.

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