From cfa28690db6532972fc9ec90ff874b400ca3a0a5 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 11 Jun 2012 23:46:17 +0200 Subject: [PATCH] cluster: don't silently drop messages when the write queue gets big --- lib/child_process.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/child_process.js b/lib/child_process.js index 4a1f9fec85e..23465a706d1 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -329,11 +329,6 @@ function setupChannel(target, channel) { return; } - // For overflow protection don't write if channel queue is too deep. - if (channel.writeQueueSize > 1024 * 1024) { - return false; - } - // package messages with a handle object if (handle) { // this message will be handled by an internalMessage event handler @@ -379,7 +374,8 @@ function setupChannel(target, channel) { writeReq.oncomplete = nop; - return true; + /* If the master is > 2 read() calls behind, please stop sending. */ + return channel.writeQueueSize < (65536 * 2); }; target.connected = true;