-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Paused stream keeps node alive #6653
Comments
Why should it exit? |
@indutny Because no more events will happen. Like this:
|
This is a good point. The only way it could be resumed is if another asynchronous event is fired after. Which would also keep the process alive. So there should be no need to keep the process open on |
see also #6305, also for some reason |
ok, so in this case we're hanging because there's no data to be read from the socket since http doesn't respond until you actually GET something, if you switch to towel.blinkenlights.nl:23 you'll eventually hit hwm and dump out. So, with that in mind I have a semi working patch, that subscribes diff --git a/lib/net.js b/lib/net.js
index 93d942a..000bad4 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -167,6 +167,7 @@ function Socket(options) {
// shut down the socket when we're finished with it.
this.on('finish', onSocketFinish);
this.on('_socketEnd', onSocketEnd);
+ this.on('pause', onSocketPause);
initSocketHandle(this);
@@ -220,6 +221,13 @@ function onSocketFinish() {
}
+function onSocketPause() {
+ debug('onSocketPause');
+ if (this._handle && this._handle.readStop)
+ this._handle.readStop();
+}
+
+
function afterShutdown(status, handle, req) {
var self = handle.owner;
|
@joyent/node-coreteam @piscisaureus ... the hang still happens in v0.10 but not in v0.12 or io.js... do we care? Is there a fix we can / should backport to v0.10? |
This is a streams question - @cjihrig or @chrisdickinson may know the answer |
Hmm.. I'm inclined just to close then and leave the v0.10 behavior as is. |
Closing. This leaves the existing v0.10 behavior alone. Can reopen if folks feel it's necessary to fix this in v0.10 |
Test code:
Both node v0.10.x and master hang and don't exit.
@isaacs, any idea? The libuv handle is clearly reading; is node secretly reading under the hood?
The text was updated successfully, but these errors were encountered: