From cbbf8ab79b7c5910d8f91052f2a4c727d3e4a744 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 13 Aug 2023 00:43:21 +0200 Subject: [PATCH] EMFILE errors now correspond to 503 Service Unavailable error code. --- config.json | 2 +- svr.js | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/config.json b/config.json index adfd2d9..a99f80f 100644 --- a/config.json +++ b/config.json @@ -3,7 +3,7 @@ "port": 80, "pubport": 80, "page404": "404.html", - "timestamp": 1691840196895, + "timestamp": 1691854862481, "blacklist": [], "nonStandardCodes": [], "enableCompression": true, diff --git a/svr.js b/svr.js index 84736fd..f46a5f9 100644 --- a/svr.js +++ b/svr.js @@ -2137,7 +2137,7 @@ if (!cluster.isPrimary) { 400: "The request you made is invalid.", 417: "Expectation in Expect property couldn't be satisfied.", 500: "The server had an unexpected error. Below, the error stack is shown:

{stack}

Please contact with developer/administrator at {contact}.", - 501: "The request requires use of a function, which isn't implemented (yet) by the server." + 501: "The request requires use of a function, which isn't currently implemented by the server." }; //Server error calling method @@ -2189,7 +2189,7 @@ if (!cluster.isPrimary) { } else if (err.code == "EACCES") { additionalError = 403; } else if (err.code == "EMFILE") { - additionalError = 429; + additionalError = 503; } else if (err.code == "ELOOP") { additionalError = 508; } @@ -2300,7 +2300,6 @@ if (!cluster.isPrimary) { if (nuobject.pathname) { nuobject.path = nuobject.pathname + (nuobject.search ? nuobject.search : ""); } - //if(nuobject.path != "" && uobject.password != "") nuobject.path = nuobject.pathname + nuobject.href; nuobject.query = {}; uobject.searchParams.forEach(function (value, key) { nuobject.query[key] = value; @@ -2594,7 +2593,7 @@ if (!cluster.isPrimary) { } else if (err.code == "EACCES") { additionalError = 403; } else if (err.code == "EMFILE") { - additionalError = 429; + additionalError = 503; } else if (err.code == "ELOOP") { additionalError = 508; } @@ -3282,7 +3281,7 @@ if (!cluster.isPrimary) { } else if (err.code == "EACCES") { additionalError = 403; } else if (err.code == "EMFILE") { - additionalError = 429; + additionalError = 503; } else if (err.code == "ELOOP") { additionalError = 508; } @@ -3677,7 +3676,7 @@ if (!cluster.isPrimary) { serverconsole.errmessage("Access denied."); return; } else if (err.code == "EMFILE") { - callServerError(500, undefined, generateErrorStack(err)); // Too many file descriptors or open files were reached by the process. It is an internal server issue. + callServerError(503); return; } else if (err.code == "ELOOP") { callServerError(508); // The symbolic link loop is detected during file system operations. @@ -3949,7 +3948,7 @@ if (!cluster.isPrimary) { callServerError(403); serverconsole.errmessage("Access denied."); } else if (err.code == "EMFILE") { - callServerError(500, undefined, generateErrorStack(err)); // Too many file descriptors or open files were reached by the process. It is an internal server issue. + callServerError(503); } else if (err.code == "ELOOP") { callServerError(508); // The symbolic link loop is detected during file system operations. serverconsole.errmessage("Symbolic link loop detected."); @@ -3982,7 +3981,7 @@ if (!cluster.isPrimary) { callServerError(403); serverconsole.errmessage("Access denied."); } else if (err.code == "EMFILE") { - callServerError(500, undefined, generateErrorStack(err)); // Too many file descriptors or open files were reached by the process. It is an internal server issue. + callServerError(503); } else if (err.code == "ELOOP") { callServerError(508); // The symbolic link loop is detected during file system operations. serverconsole.errmessage("Symbolic link loop detected."); @@ -4103,7 +4102,7 @@ if (!cluster.isPrimary) { callServerError(403); serverconsole.errmessage("Access denied."); } else if (err.code == "EMFILE") { - callServerError(500, undefined, generateErrorStack(err)); // Too many file descriptors or open files were reached by the process. It is an internal server issue. + callServerError(503); } else if (err.code == "ELOOP") { callServerError(508); // The symbolic link loop is detected during file system operations. serverconsole.errmessage("Symbolic link loop detected."); @@ -4162,7 +4161,7 @@ if (!cluster.isPrimary) { callServerError(403); serverconsole.errmessage("Access denied."); } else if (err.code == "EMFILE") { - callServerError(500, undefined, generateErrorStack(err)); // Too many file descriptors or open files were reached by the process. It is an internal server issue. + callServerError(503); } else if (err.code == "ELOOP") { callServerError(508); // The symbolic link loop is detected during file system operations. serverconsole.errmessage("Symbolic link loop detected.");