-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
fs.createWriteStream can cause out-of-order writes, in v18.16+ #51993
Labels
confirmed-bug
Issues with confirmed bugs.
Comments
dy-dx
changed the title
fs.createWriteStream can cause out-of-order writes, in v18.16+ and v19.8+
fs.createWriteStream can cause out-of-order writes, in v18.16+
Mar 6, 2024
I'm sorry it caused a regression this far down. Will patch it. Hopefully we can backport the fix to v18. |
mcollina
added a commit
to mcollina/node
that referenced
this issue
Mar 7, 2024
targos
pushed a commit
that referenced
this issue
Mar 8, 2024
Fixes: #51993 PR-URL: #52005 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
richardlau
pushed a commit
that referenced
this issue
Mar 23, 2024
Fixes: #51993 PR-URL: #52005 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
richardlau
pushed a commit
that referenced
this issue
Mar 25, 2024
Fixes: #51993 PR-URL: #52005 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
richardlau
pushed a commit
that referenced
this issue
Mar 25, 2024
Fixes: #51993 PR-URL: #52005 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
rdw-msft
pushed a commit
to rdw-msft/node
that referenced
this issue
Mar 26, 2024
Fixes: nodejs#51993 PR-URL: nodejs#52005 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
jcbhmr
pushed a commit
to jcbhmr/node
that referenced
this issue
May 15, 2024
Fixes: nodejs#51993 PR-URL: nodejs#52005 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
v18.16.0 and up, v19.8.0 and up, v20.x, v21.x
Platform
Darwin x86_64
Subsystem
fs, stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
helloworld
What do you see instead?
worldhello
Additional information
The issue was caused by this change: #46818, which landed in node
v18.16.0
andv19.8.0
.(Thanks to @Fadorico for tracking down this change. I have also confirmed this by building node locally.)
This is causing the 'unzipper' module to create corrupted files, because its 'fstream' dependency uses
fs.createWriteStream()
like in the example above.It looks like when the stream's "open" event fires, the stream does not yet have the "constructed" flag set, so that might be why things are getting weird.
As a workaround, if I wait an additional tick after the "open" event, there are no issues:
The text was updated successfully, but these errors were encountered: