Skip to content

Invalid state: Reader released #41858

Closed
Closed
@essential-existence

Description

@essential-existence

Version

17.4.0

Platform

No response

Subsystem

No response

What steps will reproduce the bug?

import { ReadableStream } from 'node:stream/web';
import { setTimeout, setInterval } from 'node:timers/promises';

const input = new ReadableStream(
  {  // underlyingSource
    start( controller ) { },
    async pull( controller ) {
      await setInterval( 1000 );
      const chunk = performance.now();
      console.log( 'INPUT_READ_PULL', chunk );
      controller.enqueue( chunk );
    },
    cancel( reason ) { },
    type: undefined,
    autoAllocateChunkSize: undefined,
  },
  {  // strategy
    highWaterMark: undefined,
    size: undefined,
  },
);

const input_reader = input.getReader( {
  'mode': undefined,
} );

input_reader.closed.then( () => {
  console.log( 'INPUT_READ__CLOSE' );
} );

//await setTimeout( 2000 );

input_reader.releaseLock();

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

input_reader.closed.then( () => {} );

What is the expected behavior?

No response

What do you see instead?

TypeError [ERR_INVALID_STATE]: Invalid state: Reader released

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.web streams

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions