-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
reevaluate how to set writable = false in IncomingMessage #20233
Comments
I think it's nearly impossible without breaking a super popular module. See #15029 and #15404 Specifically it's because ping @mafintosh @mcollina |
I believe one way could be into fooling eos into thinking it's a i.e. if we just add a dummy property on this.setHeader = 'this is a truthy dummy value for eos' It's a bit hacky. But I think it's better than the public API being "incorrect". |
I think we would want to avoid adding hacks like that. It's hard to know what else it could break since it would then start to resemble (The alternative along the same lines would be adding dummy writableState but it's bad for the same reason as above.) |
How about if we ask As it is now the API is a bit broken and I've seen people doing this: if (!res.headersSent && res.writable) {
res.writeHead(500)
res.end()
} else {
res.destroy()
} We might need a strategy for packages that depend on broken behavior? |
Alternatively we could deprecate |
Would another idea be to implement hot patching in the module loader to re-write known broken package instances? Sorry, just thinking of all crazy ideas I can come up with. |
The only solution is to make OutgoingMessage a Writable. However, that causes a major performance regression (I tried that). It is possible to implement some fix for this, but it will take a lot of time. The generic idea is to make sure end-of-stream do not need to check for _writableState, and it uses accessor properties instead. However, we just got finished on Node 10, which should behave similarly. I’m -1 for the time being, the solution is going to be very hard, and it will also require time to the ecosystem to catch up. The good news is that we are working to improve streams, and we should be able to fix this in the future by not having userland to resort to _writableState access. cc @mafintosh |
If someone wants to improve eos to not use the legacy mode for newer http streams in Node I'd be 👍. Unsure how tricky that is when supporting older Node.js versions at the same time. |
A solution could be if there was a way in core streams to detect if a stream is a newer stream that didn't involve checking for _readableState etc |
Given: 8589c70
What oss project do we need support? Would be good to have a list so we can make some progress on this issue.
The text was updated successfully, but these errors were encountered: