Skip to content
This repository
Browse code

cluster: don't silently drop messages when the write queue gets big

  • Loading branch information...
commit bb2ce1a108b3c852a413c641bd021c9c25598d34 1 parent f482236
Bert Belder authored June 11, 2012

Showing 1 changed file with 2 additions and 6 deletions. Show diff stats Hide diff stats

  1. 8  lib/child_process.js
8  lib/child_process.js
@@ -117,11 +117,6 @@ function setupChannel(target, channel) {
117 117
 
118 118
     if (!target._channel) throw new Error("channel closed");
119 119
 
120  
-    // For overflow protection don't write if channel queue is too deep.
121  
-    if (channel.writeQueueSize > 1024 * 1024) {
122  
-      return false;
123  
-    }
124  
-
125 120
     var buffer = Buffer(JSON.stringify(message) + '\n');
126 121
 
127 122
     if (sendHandle && setSimultaneousAccepts) {
@@ -137,7 +132,8 @@ function setupChannel(target, channel) {
137 132
 
138 133
     writeReq.oncomplete = nop;
139 134
 
140  
-    return true;
  135
+    /* If the master is > 2 read() calls behind, please stop sending. */
  136
+    return channel.writeQueueSize < (65536 * 2);
141 137
   };
142 138
 
143 139
   channel.readStart();

0 notes on commit bb2ce1a

Please sign in to comment.
Something went wrong with that request. Please try again.