summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2025-06-13 07:14:28 +0000
committerdakkar <dakkar@thenautilus.net>2025-06-13 07:14:28 +0000
commit99bf3153517eef73b2e301edc26448d9b1ed7323 (patch)
tree4cc5a910a3674ad5665ff2e67e7f8bee26a2f7a8
parentmerge: Consolidate duplicate HTML/XML parser libraries (!1083) (diff)
parentadd additional process exit loggers (diff)
downloadsharkey-99bf3153517eef73b2e301edc26448d9b1ed7323.tar.gz
sharkey-99bf3153517eef73b2e301edc26448d9b1ed7323.tar.bz2
sharkey-99bf3153517eef73b2e301edc26448d9b1ed7323.zip
merge: Fix uncaught exception hooks and add more shutdown logging. (!1111)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1111 Approved-by: Marie <github@yuugi.dev> Approved-by: dakkar <dakkar@thenautilus.net>
-rw-r--r--packages/backend/src/boot/entry.ts28
-rw-r--r--packages/frontend-shared/build.js2
-rw-r--r--packages/misskey-bubble-game/build.js2
-rw-r--r--packages/misskey-js/build.js2
-rw-r--r--packages/misskey-reversi/build.js2
5 files changed, 27 insertions, 9 deletions
diff --git a/packages/backend/src/boot/entry.ts b/packages/backend/src/boot/entry.ts
index e52d77ab9b..afb48e526c 100644
--- a/packages/backend/src/boot/entry.ts
+++ b/packages/backend/src/boot/entry.ts
@@ -64,17 +64,35 @@ async function main() {
}
// Display detail of uncaught exception
- process.on('uncaughtException', err => {
+ process.on('uncaughtExceptionMonitor', ((err, origin) => {
try {
- logger.error('Uncaught exception:', err);
+ logger.error(`Uncaught exception (${origin}):`, err);
} catch {
- console.error('Uncaught exception:', err);
+ console.error(`Uncaught exception (${origin}):`, err);
}
- });
+ }));
// Dying away...
+ process.on('disconnect', () => {
+ try {
+ logger.warn('IPC channel disconnected! The process may soon die.');
+ } catch {
+ console.warn('IPC channel disconnected! The process may soon die.');
+ }
+ });
+ process.on('beforeExit', code => {
+ try {
+ logger.warn(`Event loop died! Process will exit with code ${code}.`);
+ } catch {
+ console.warn(`Event loop died! Process will exit with code ${code}.`);
+ }
+ });
process.on('exit', code => {
- logger.info(`The process is going to exit with code ${code}`);
+ try {
+ logger.info(`The process is going to exit with code ${code}`);
+ } catch {
+ console.info(`The process is going to exit with code ${code}`);
+ }
});
//#endregion
diff --git a/packages/frontend-shared/build.js b/packages/frontend-shared/build.js
index 9941114757..f3a94fe364 100644
--- a/packages/frontend-shared/build.js
+++ b/packages/frontend-shared/build.js
@@ -101,7 +101,7 @@ async function watchSrc() {
process.on('SIGHUP', resolve);
process.on('SIGINT', resolve);
process.on('SIGTERM', resolve);
- process.on('uncaughtException', reject);
+ process.on('uncaughtExceptionMonitor', reject);
process.on('exit', resolve);
}).finally(async () => {
await context.dispose();
diff --git a/packages/misskey-bubble-game/build.js b/packages/misskey-bubble-game/build.js
index 5d534cc6fd..93a695e649 100644
--- a/packages/misskey-bubble-game/build.js
+++ b/packages/misskey-bubble-game/build.js
@@ -99,7 +99,7 @@ async function watchSrc() {
process.on('SIGHUP', resolve);
process.on('SIGINT', resolve);
process.on('SIGTERM', resolve);
- process.on('uncaughtException', reject);
+ process.on('uncaughtExceptionMonitor', reject);
process.on('exit', resolve);
}).finally(async () => {
await context.dispose();
diff --git a/packages/misskey-js/build.js b/packages/misskey-js/build.js
index b794592815..76a95fb3f5 100644
--- a/packages/misskey-js/build.js
+++ b/packages/misskey-js/build.js
@@ -100,7 +100,7 @@ async function watchSrc() {
process.on('SIGHUP', resolve);
process.on('SIGINT', resolve);
process.on('SIGTERM', resolve);
- process.on('uncaughtException', reject);
+ process.on('uncaughtExceptionMonitor', reject);
process.on('exit', resolve);
}).finally(async () => {
await context.dispose();
diff --git a/packages/misskey-reversi/build.js b/packages/misskey-reversi/build.js
index 5d534cc6fd..93a695e649 100644
--- a/packages/misskey-reversi/build.js
+++ b/packages/misskey-reversi/build.js
@@ -99,7 +99,7 @@ async function watchSrc() {
process.on('SIGHUP', resolve);
process.on('SIGINT', resolve);
process.on('SIGTERM', resolve);
- process.on('uncaughtException', reject);
+ process.on('uncaughtExceptionMonitor', reject);
process.on('exit', resolve);
}).finally(async () => {
await context.dispose();