forked from svrjs/svrjs
Update to SVR.JS 3.4.38
This commit is contained in:
parent
5849cec7e6
commit
50929c958d
4 changed files with 69 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.4.37</title>
|
<title>SVR.JS 3.4.38</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Welcome to SVR.JS 3.4.37</h1>
|
<h1>Welcome to SVR.JS 3.4.38</h1>
|
||||||
<br/>
|
<br/>
|
||||||
<img src="/logo.png" style="width: 256px;" />
|
<img src="/logo.png" style="width: 256px;" />
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -119,7 +119,9 @@
|
||||||
</div>
|
</div>
|
||||||
<p>Changes:</p>
|
<p>Changes:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed bug with non-standard code regex replacements</li>
|
<li>SVR.JS now sends configuration file saving request to one random good worker instead of all workers to prevent configuration file corruption.</li>
|
||||||
|
<li>Fixed crashes due to destroyed HTTP/2 stream (Node.JS bug: <a href="https://github.com/nodejs/node/issues/24470">https://github.com/nodejs/node/issues/24470</a>)</li>
|
||||||
|
<li>Fixed crash while trying to report communication problem with workers.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="/tests.html">Tests</a><br/>
|
<a href="/tests.html">Tests</a><br/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.4.37 Licenses</title>
|
<title>SVR.JS 3.4.38 Licenses</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.4.37 Licenses</h1>
|
<h1>SVR.JS 3.4.38 Licenses</h1>
|
||||||
<h2>SVR.JS 3.4.37</h2>
|
<h2>SVR.JS 3.4.38</h2>
|
||||||
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
||||||
MIT License<br/>
|
MIT License<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
||||||
SOFTWARE.<br/>
|
SOFTWARE.<br/>
|
||||||
</div>
|
</div>
|
||||||
<h2>Packages used by SVR.JS 3.4.37 and utilities</h2>
|
<h2>Packages used by SVR.JS 3.4.38 and utilities</h2>
|
||||||
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
|
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
|
||||||
<div style="float: right;">License: MIT</div>
|
<div style="float: right;">License: MIT</div>
|
||||||
<div style="font-size: 20px;">
|
<div style="font-size: 20px;">
|
||||||
|
|
71
svr.js
71
svr.js
|
@ -71,7 +71,7 @@ function deleteFolderRecursive(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var os = require("os");
|
var os = require("os");
|
||||||
var version = "3.4.37";
|
var version = "3.4.38";
|
||||||
var singlethreaded = false;
|
var singlethreaded = false;
|
||||||
|
|
||||||
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
|
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
|
||||||
|
@ -340,7 +340,7 @@ function SVRJSFork() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newWorker.on("error", function (err) {
|
newWorker.on("error", function (err) {
|
||||||
if(!reallyExiting) serverconsole.locwarnmessage("There was a problem when handling SVR.JS worker! (from master process side) Reason: " + err.message);
|
serverconsole.locwarnmessage("There was a problem when handling SVR.JS worker! (from master process side) Reason: " + err.message);
|
||||||
});
|
});
|
||||||
newWorker.on("exit", function () {
|
newWorker.on("exit", function () {
|
||||||
if (!exiting && Object.keys(cluster.workers).length == 0) {
|
if (!exiting && Object.keys(cluster.workers).length == 0) {
|
||||||
|
@ -2815,7 +2815,11 @@ if (!cluster.isPrimary) {
|
||||||
delete table["connection"];
|
delete table["connection"];
|
||||||
delete table["keep-alive"];
|
delete table["keep-alive"];
|
||||||
delete table["upgrade"];
|
delete table["upgrade"];
|
||||||
return response.writeHeadNodeApi(a, table);
|
if(res.stream && res.stream.destroyed) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return res.writeHeadNodeApi(a, table);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
response.setHeader = function (a, b) {
|
response.setHeader = function (a, b) {
|
||||||
|
@ -4263,6 +4267,8 @@ function bruteForceListenerWrapper(worker) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isWorkerHungUpBuff2 = true;
|
||||||
|
|
||||||
function msgListener(msg) {
|
function msgListener(msg) {
|
||||||
for (var i = 0; i < Object.keys(cluster.workers).length; i++) {
|
for (var i = 0; i < Object.keys(cluster.workers).length; i++) {
|
||||||
if (msg == "\x12END") {
|
if (msg == "\x12END") {
|
||||||
|
@ -4279,6 +4285,8 @@ function msgListener(msg) {
|
||||||
serverconsole.locmessage("Configuration saved.");
|
serverconsole.locmessage("Configuration saved.");
|
||||||
} else if (msg.indexOf("\x12SAVEERR") == 0) {
|
} else if (msg.indexOf("\x12SAVEERR") == 0) {
|
||||||
serverconsole.locwarnmessage("There was a problem, while saving configuration file. Reason: " + msg.substr(8));
|
serverconsole.locwarnmessage("There was a problem, while saving configuration file. Reason: " + msg.substr(8));
|
||||||
|
} else if (msg == "\x12PINGOK") {
|
||||||
|
if(typeof isWorkerHungUpBuff2 != "undefined") isWorkerHungUpBuff2 = false;
|
||||||
} else if (msg == "\x12OPEN") {
|
} else if (msg == "\x12OPEN") {
|
||||||
closedMaster = false;
|
closedMaster = false;
|
||||||
} else if (msg == "\x12END") {
|
} else if (msg == "\x12END") {
|
||||||
|
@ -4504,21 +4512,55 @@ function start(init) {
|
||||||
} else if (cluster.isPrimary) {
|
} else if (cluster.isPrimary) {
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
var allClusters = Object.keys(cluster.workers);
|
var allClusters = Object.keys(cluster.workers);
|
||||||
for (var i = 0; i < allClusters.length; i++) {
|
var goodWorkers = [];
|
||||||
|
function checkWorker(callback, _id) {
|
||||||
|
if(typeof _id === "undefined") _id = 0;
|
||||||
|
if(_id >= allClusters.length) {
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (cluster.workers[allClusters[i]]) {
|
if (cluster.workers[allClusters[_id]]) {
|
||||||
cluster.workers[allClusters[i]].on("message", msgListener);
|
isWorkerHungUpBuff2 = true;
|
||||||
cluster.workers[allClusters[i]].send("\x14SAVECONF");
|
cluster.workers[allClusters[_id]].on("message", msgListener);
|
||||||
|
cluster.workers[allClusters[_id]].send("\x14PINGPING");
|
||||||
|
setTimeout(function () {
|
||||||
|
if (isWorkerHungUpBuff2) {
|
||||||
|
checkWorker(callback, _id+1);
|
||||||
|
} else {
|
||||||
|
goodWorkers.push(allClusters[_id]);
|
||||||
|
checkWorker(callback, _id+1);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
}, 250);
|
||||||
if (cluster.workers[allClusters[i]]) {
|
} else {
|
||||||
cluster.workers[allClusters[i]].removeAllListeners("message");
|
checkWorker(callback, _id+1);
|
||||||
cluster.workers[allClusters[i]].on("message", bruteForceListenerWrapper(cluster.workers[allClusters[i]]));
|
|
||||||
cluster.workers[allClusters[i]].on("message", listenConnListener);
|
|
||||||
}
|
}
|
||||||
serverconsole.locwarnmessage("There was a problem, while saving configuration file. Reason: " + ex.message);
|
} catch (err) {
|
||||||
|
if (cluster.workers[allClusters[_id]]) {
|
||||||
|
cluster.workers[allClusters[_id]].removeAllListeners("message");
|
||||||
|
cluster.workers[allClusters[_id]].on("message", bruteForceListenerWrapper(cluster.workers[allClusters[_id]]));
|
||||||
|
cluster.workers[allClusters[_id]].on("message", listenConnListener);
|
||||||
|
}
|
||||||
|
checkWorker(callback, _id+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
checkWorker(function () {
|
||||||
|
var wN = Math.floor(Math.random() * goodWorkers.length); //Send a configuration saving message to a random worker.
|
||||||
|
try {
|
||||||
|
if (cluster.workers[goodWorkers[wN]]) {
|
||||||
|
isWorkerHungUpBuff2 = true;
|
||||||
|
cluster.workers[goodWorkers[wN]].on("message", msgListener);
|
||||||
|
cluster.workers[goodWorkers[wN]].send("\x14SAVECONF");
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (cluster.workers[goodWorkers[wN]]) {
|
||||||
|
cluster.workers[goodWorkers[wN]].removeAllListeners("message");
|
||||||
|
cluster.workers[goodWorkers[wN]].on("message", bruteForceListenerWrapper(cluster.workers[goodWorkers[wN]]));
|
||||||
|
cluster.workers[goodWorkers[wN]].on("message", listenConnListener);
|
||||||
|
}
|
||||||
|
serverconsole.locwarnmessage("There was a problem while saving configuration file. Reason: " + err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
}, 300000);
|
}, 300000);
|
||||||
}
|
}
|
||||||
if (!cluster.isPrimary && cluster.isPrimary !== undefined) {
|
if (!cluster.isPrimary && cluster.isPrimary !== undefined) {
|
||||||
|
@ -4536,6 +4578,9 @@ function start(init) {
|
||||||
process.send("\x12SAVEERR" + ex.message);
|
process.send("\x12SAVEERR" + ex.message);
|
||||||
}
|
}
|
||||||
process.send("\x12END");
|
process.send("\x12END");
|
||||||
|
} else if (line == "\x14PINGPING") {
|
||||||
|
process.send("\x12PINGOK");
|
||||||
|
process.send("\x12END");
|
||||||
} else if (commands[line.split(" ")[0]] !== undefined && commands[line.split(" ")[0]] !== null) {
|
} else if (commands[line.split(" ")[0]] !== undefined && commands[line.split(" ")[0]] !== null) {
|
||||||
var argss = line.split(" ");
|
var argss = line.split(" ");
|
||||||
var command = argss.shift();
|
var command = argss.shift();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.4.37 Tests</title>
|
<title>SVR.JS 3.4.38 Tests</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.4.37 Tests</h1>
|
<h1>SVR.JS 3.4.38 Tests</h1>
|
||||||
<h2>Directory</h2>
|
<h2>Directory</h2>
|
||||||
<iframe src="/testdir" width="50%" height="300px"></iframe>
|
<iframe src="/testdir" width="50%" height="300px"></iframe>
|
||||||
<h2>Directory (with query)</h2>
|
<h2>Directory (with query)</h2>
|
||||||
|
|
Reference in a new issue