Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error [ERR_STREAM_PUSH_AFTER_EOF]: stream.push() after EOF #43325

Open
masx200 opened this issue Jun 6, 2022 · 2 comments
Open

Error [ERR_STREAM_PUSH_AFTER_EOF]: stream.push() after EOF #43325

masx200 opened this issue Jun 6, 2022 · 2 comments
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@masx200
Copy link
Contributor

masx200 commented Jun 6, 2022

Version

v18.3.0

Platform

Microsoft Windows NT 10.0.22621.0 x64

Subsystem

No response

What steps will reproduce the bug?

import stream from "stream";

await test2();

async function test2() {
    console.log("good");
    const readable = stream.Readable.from("11111222222222".repeat(999));

    const readableStream = stream.Readable.toWeb(readable);
    const [stream1, stream2] = readableStream.tee();
    //good
    //
    const streams = [stream1, stream2];
    await Promise.all(
        streams.map(async (temp) => {
            console.log(temp);
            for await (const data of stream.Readable.fromWeb(temp)) {
                console.log(data);
            }
        })
    );
}

await test1();

async function test1() {
    console.log("error");
    const readable = stream.Readable.from("11111222222222".repeat(999));

    const readableStream = stream.Readable.toWeb(readable);
    const [stream1, stream2] = readableStream.tee();
    //error
    console.log(stream1);
    for await (const data of stream.Readable.fromWeb(stream1)) {
        console.log(data);
    }
    console.log(stream2);
    for await (const data of stream.Readable.fromWeb(stream2)) {
        console.log(data);
    }
}
 node "C:\Documents\test\test.mjs"

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

100% occur.

What is the expected behavior?

no errors

What do you see instead?


good
ReadableStream { locked: false, state: 'readable', supportsBYOB: false }
ReadableStream { locked: false, state: 'readable', supportsBYOB: false }
<Buffer 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 ... 13936 more bytes>
<Buffer 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 ... 13936 more bytes>
error
ReadableStream { locked: false, state: 'readable', supportsBYOB: false }
<Buffer 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 32 32 32 32 32 32 31 31 31 31 31 32 32 32 ... 13936 more bytes>
ReadableStream { locked: false, state: 'readable', supportsBYOB: false }
node:internal/process/esm_loader:91
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_STREAM_PUSH_AFTER_EOF]: stream.push() after EOF
    at new NodeError (node:internal/errors:377:5)
    at readableAddChunk (node:internal/streams/readable:285:30)
    at Readable.push (node:internal/streams/readable:234:10)
    at node:internal/webstreams/adapters:481:22
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_STREAM_PUSH_AFTER_EOF'
}

Node.js v18.3.0

Additional information

No response

@davedoesdev
Copy link
Contributor

Is this a duplicate of #42694 ?

@y1d7ng
Copy link
Contributor

y1d7ng commented Apr 24, 2024

@masx200 Looks like the latest version doesn't have this issue anymore. cc @VoltrexKeyva

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants