This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Streams v2 problem with SSL #4657
Milestone
Comments
/cc @isaacs |
Wow, CryptoStream never got streams2-ified. That's a pretty huge oversight on my part. Nice catch. Short term, this will stop the leak: diff --git a/lib/http.js b/lib/http.js
index ae6976a..f52624b 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -36,13 +36,21 @@ if (process.env.NODE_DEBUG && /http/.test(process.env.NODE_DEBUG)) {
}
function readStart(socket) {
- if (!socket || !socket._handle || !socket._handle.readStart) return;
- socket._handle.readStart();
+ if (!socket)
+ return;
+ if (socket._handle && socket._handle.readStart)
+ socket._handle.readStart();
+ else if (socket.resume)
+ socket.resume();
}
function readStop(socket) {
- if (!socket || !socket._handle || !socket._handle.readStop) return;
- socket._handle.readStop();
+ if (!socket)
+ return;
+ if (socket._handle && socket._handle.readStop)
+ socket._handle.readStop();
+ else if (socket.pause)
+ socket.pause();
}
// Only called in the slow case where slow means but more properly, CryptoStream needs to be refactored. |
ghost
assigned isaacs
Jan 30, 2013
I can probably look into it. (CryptoStream 2.0) |
@indutny Your help would be much appreciated. Also, it'd be a good thing to get your head around streams2 so we have another person who can debug issues. |
Done in d59beb9 |
Gentlemen, my test case posted in the issue is still not working properly. 😱 |
Confirming, the problem is so obvious that it makes me feel sad. We should stop using |
@jerem can you try commit above? ^ |
It fixed my test case. 👏 |
indutny
added a commit
to indutny/node
that referenced
this issue
Feb 21, 2013
lib/http.js is using stream._handle.readStart/readStop to control data-flow coming out from underlying stream. If this methods are not present - data might be buffered regardless of whether it'll be read. see nodejs#4657
Fixed in d534c2b |
indutny
added a commit
that referenced
this issue
Feb 21, 2013
lib/http.js is using stream._handle.readStart/readStop to control data-flow coming out from underlying stream. If this methods are not present - data might be buffered regardless of whether it'll be read. see #4657
Oops, in ebc95f0 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It seems streams 2 with SSL doesn't work properly. Indeed, as soon as you read something on the stream it internally keeps reading the whole content of the stream. (Tested on both 0.9.7 and master branch as of today)
Have a look at the following code and see how the memory and the buffer length keep increasing:
Which outputs something like this on my machine:
The exact same code without SSL works properly:
Output:
The text was updated successfully, but these errors were encountered: