-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Stream is not destroyed on error #25
Comments
Which stream should be destroyed? I thought streams are automatically destroyed on error unless there's a handler. |
The thing is that there is a handler. If there's an error of any kind, Got tries to read the response. But since the stream is not destroyed, it just hangs on Node.js >= 14.0.0. I'd just replace Lines 25 to 35 in a31bde7
with const finalStream = streamPipeline(response, decompress, stream, error => {
if (error) {
if (error.code === 'Z_BUF_ERROR') {
stream.end();
return;
}
stream.destroy(error);
}
}); |
Sounds good. You know streams better than me. |
Nah, I just randomly stumbled upon a Got issue and found a culprit :P But it doesn't hang on Node.js 13 so probably something has changed under the hood. |
I think it's either https://github.com/nodejs/node/pull/31182/files or https://github.com/nodejs/node/pull/32158/files or maybe both. But it's nice to see stream improvements. |
Instead, an
error
event is emitted:decompress-response/index.js
Line 32 in a31bde7
This causes
getStream()
to hang on Node.js 14.1.0.The text was updated successfully, but these errors were encountered: