server: Use wtfnode to log reasons why node isn't exiting

pull/4656/head
Richard Hansen 2020-12-15 03:23:12 -05:00 committed by John McLear
parent ba81ead101
commit 877f0c5883
4 changed files with 19 additions and 2 deletions

8
package-lock.json generated
View File

@ -870,7 +870,8 @@
"tinycon": "0.0.1",
"ueberdb2": "^1.2.5",
"underscore": "1.8.3",
"unorm": "1.4.1"
"unorm": "1.4.1",
"wtfnode": "^0.8.4"
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": {
@ -10577,6 +10578,11 @@
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"wtfnode": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/wtfnode/-/wtfnode-0.8.4.tgz",
"integrity": "sha512-64GEKtMt/MUBuAm+8kHqP74ojjafzu00aT0JKsmkIwYmjRQ/odO0yhbzKLm+Z9v1gMla+8dwITRKzTAlHsB+Og=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",

View File

@ -27,6 +27,10 @@
const log4js = require('log4js');
log4js.replaceConsole();
// wtfnode should be loaded after log4js.replaceConsole() so that it uses log4js for logging, and it
// should be above everything else so that it can hook in before resources are used.
const wtfnode = require('wtfnode');
/*
* early check for version compatibility before calling
* any modules that require newer versions of NodeJS
@ -211,6 +215,7 @@ exports.exit = async (err = null) => {
setTimeout(() => {
console.error('Something that should have been cleaned up during the shutdown hook (such as ' +
'a timer, worker thread, or open connection) is preventing Node.js from exiting');
wtfnode.dump();
console.error('Forcing an unclean exit...');
process.exit(1);
}, 5000).unref();

5
src/package-lock.json generated
View File

@ -8659,6 +8659,11 @@
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz",
"integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA=="
},
"wtfnode": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/wtfnode/-/wtfnode-0.8.4.tgz",
"integrity": "sha512-64GEKtMt/MUBuAm+8kHqP74ojjafzu00aT0JKsmkIwYmjRQ/odO0yhbzKLm+Z9v1gMla+8dwITRKzTAlHsB+Og=="
},
"xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",

View File

@ -72,7 +72,8 @@
"tinycon": "0.0.1",
"ueberdb2": "^1.2.5",
"underscore": "1.8.3",
"unorm": "1.4.1"
"unorm": "1.4.1",
"wtfnode": "^0.8.4"
},
"bin": {
"etherpad-lite": "node/server.js"