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

writable.end(cb), the cb is never called #40851

Open
a1exwang opened this issue Nov 18, 2021 · 5 comments
Open

writable.end(cb), the cb is never called #40851

a1exwang opened this issue Nov 18, 2021 · 5 comments
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@a1exwang
Copy link

Version

16.12.0

Platform

Linux alex-p330 5.13.0-19-generic #19-Ubuntu SMP Thu Oct 7 21:58:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

stream

What steps will reproduce the bug?

touch testfile
chmod 400 testfile
  1. create test.js with the following content
const stream = require("stream");
const fs = require("fs");

const w = fs.createWriteStream("testfile");
w.write("test")
stream.finished(w, (e) => {
  console.log('finished(): ' + e)
  w.end(() => {
    console.log('end()')
  })
})

setTimeout(() => { console.log("timeout"); }, 10 * 1000)
  1. node test.js and wait 10 seconds

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

always

What is the expected behavior?

finished(): Error: EACCES: permission denied, open 'testfile'
end()
timeout

What do you see instead?

finished(): Error: EACCES: permission denied, open 'testfile'
timeout

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the stream Issues and PRs related to the stream subsystem. label Nov 18, 2021
@ronag
Copy link
Member

ronag commented Nov 18, 2021

Can you confirm whether you have the same error on v17?

@ronag
Copy link
Member

ronag commented Nov 18, 2021

I'm unable to reproduce on master.

@targos
Copy link
Member

targos commented Nov 21, 2021

@ronag do you know what fixed it? Can we backport it to LTS?

@alex-petrov-vt
Copy link

I get the expected behavior when running this on node v16.12.0, v16.13.0 and v17.1.0 (both locally and in docker). I do get the same issue as @a1exwang when running on node v14.17.2 but I'm not sure if that's the expected behavior for that version.

Just wanted to leave this info here in case someone finds it useful

@MoonBall
Copy link
Member

I get the expected behavior when running this on code of master branch. My OS is masOS Monterey.

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

6 participants