Skip to content

Commit 81b3305

Browse files
committed
Fix potential issue when crashing on error
1 parent 1acdc18 commit 81b3305

File tree

5 files changed

+4
-45
lines changed

5 files changed

+4
-45
lines changed

Diff for: .versions

-41
This file was deleted.

Diff for: lib/server/balancer/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ Balancer._proxyWeb = function _proxyWeb(req, res, endpoint, cookies, retries) {
165165
console.error("Cluster: web proxy error: ", message);
166166
if(!dontSendHeaders) {
167167
res.writeHead(500);
168+
res.end("Internal Error: Please reload.");
168169
}
169-
res.end("Internal Error: Please reload.");
170170
}
171171
});
172172
};

Diff for: lib/server/balancer/workers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Balancer._processHereHTTP = function _processHereHTTP(req, res) {
8080
// Make sure we support long polling
8181
res.setTimeout(2 * 60 * 1000);
8282
Balancer.proxy.web(req, res, {target: target}, function(err) {
83-
res.end();
83+
// res.end();
8484
// Since this is long polling, error can happen even if user close the
8585
// session. That's why we don't print the message.
8686

Diff for: tests/server/balancer/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function(test) {
262262

263263
Balancer._proxyWeb(req, res, endpoint, cookies);
264264

265-
test.equal(res.end.callCount, 1);
265+
test.equal(res.end.callCount, 0);
266266
test.equal(res.writeHead.callCount, 0);
267267
proxyMock.verify();
268268
proxyMock.restore();

Diff for: tests/server/balancer/workers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function(test) {
174174
var lastArg = web.getCall(0).args.pop();
175175
lastArg();
176176

177-
test.isTrue(res.end.calledOnce);
177+
test.isFalse(res.end.calledOnce);
178178

179179
// let's call again
180180
Balancer._processHereHTTP(req, res);

0 commit comments

Comments
 (0)