-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Fixed OutgoingMessage so that it inherits from stream.Writable instead of stream #45834
Conversation
… instead of stream http.OutgoingMessage is supposed to be an instance of stream.Writable, so I set the prototype of OutgoingMessage equal to the Writable prototype and I called the Writable consrtuctor at the end of the constructor for OutgoingMessage. I made sure to override any methods and prpoperties in Writable that were already defined in OutgoingMessage in order to not interfere with the current behavior of OutgoingMessage. Fixes: nodejs#44188
… instead of stream http.OutgoingMessage is supposed to be an instance of stream.Writable, so I set the prototype of OutgoingMessage equal to the Writable prototype and I called the Writable consrtuctor at the end of the constructor for OutgoingMessage. I made sure to override any methods and prpoperties in Writable that were already defined in OutgoingMessage in order to not interfere with the current behavior of OutgoingMessage. Fixes: nodejs#44188
I accidentally left a script.sh file that copied all of the test files into a different directory in a previous commit. I did not end up using the script.sh and have now removed it from the repo. Fixes: nodejs#44188
Review requested:
|
@@ -0,0 +1,13 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to remove this file
@@ -53,6 +53,7 @@ const { | |||
getHighWaterMark, | |||
getDefaultHighWaterMark | |||
} = require('internal/streams/state'); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These newline only file changes should be removed (including the one in the test file).
assert.strictEqual(isWritable, true); | ||
|
||
|
||
const b = typeof nodeStreamResponse?._writableState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and other lines won't pass the linter. Make sure you run make test
locally to make sure all other tests pass in addition to the linting.
I think an immediate concern here is about compatibility with userland. At the very least a citgm will be needed and even then I'd be very wary of making a change like this. |
We have tried to do this multiple times in the past but the performance regression was significant. So unless V8 has implemented some magic since then I don't think we can do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a feeling this will not be possible because:
-
Express and many other frameworks rely on this specific internal structure.
-
performance of http would be crippled
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
http: fixed OutgoingMessage so that it inherits from stream.Writable instead of stream
http.OutgoingMessage is supposed to be an instance of stream.Writable, so I set
the prototype of OutgoingMessage equal to the Writable prototype and I called
the Writable consrtuctor at the end of the constructor for OutgoingMessage. I
made sure to override any methods and prpoperties in Writable that were
already defined in OutgoingMessage in order to not interfere with the
current behavior of OutgoingMessage. Note that I have recently
been told that this change does lead to performance issues with http.OutgoingMessage.
Fixes: #44188