From 0dd3dd35e6c621084c6c8aaed0f89d2ec0c09d53 Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Fri, 28 Jun 2024 14:17:02 +0200 Subject: [PATCH 1/3] CLDSRV-544: Add timestamp on stderr The previous version would not exit the master of the cluster Now it exits as it should do --- index.js | 12 ++++++------ package.json | 2 +- yarn.lock | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index c026b45293..cf5a2cd72d 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,10 @@ 'use strict'; // eslint-disable-line strict -/** - * Catch uncaught exceptions and add timestamp to aid debugging - */ -process.on('uncaughtException', err => { - process.stderr.write(`${new Date().toISOString()}: Uncaught exception: \n${err.stack}`); -}); +require('werelogs').stderrUtils.catchAndTimestampStderr( + undefined, + // Do not exit as workers have their own listener that will exit + // But primary don't have another listener + require('cluster').isPrimary ? 1 : null, +); require('./lib/server.js')(); diff --git a/package.json b/package.json index ce93b36fdc..d060ed8047 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "utf8": "~2.1.1", "uuid": "^3.0.1", "vaultclient": "scality/vaultclient#7.10.10", - "werelogs": "scality/werelogs#8.1.4", + "werelogs": "scality/werelogs#8.1.5", "xml2js": "~0.4.16" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 4d4460a3df..27f440bff7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5481,6 +5481,13 @@ werelogs@scality/werelogs#8.1.4: fast-safe-stringify "^2.1.1" safe-json-stringify "^1.2.0" +werelogs@scality/werelogs#8.1.5: + version "8.1.5" + resolved "https://codeload.github.com/scality/werelogs/tar.gz/4131abec824a336eeb68b531e6c91f2748a0644a" + dependencies: + fast-safe-stringify "^2.1.1" + safe-json-stringify "^1.2.0" + werelogs@scality/werelogs#GA7.2.0.5: version "7.2.0" resolved "https://codeload.github.com/scality/werelogs/tar.gz/bc034589ebf7810d6e6d61932f94327976de6eef" From ca0904f5843cb73918cdf19adf5b194e1dc10067 Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Fri, 28 Jun 2024 15:24:58 +0200 Subject: [PATCH 2/3] CLDSRV-544 Add timestamp on stderr utapi v1 --- lib/utapi/utapi.js | 1 + lib/utapi/utapiReindex.js | 1 + lib/utapi/utapiReplay.js | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/utapi/utapi.js b/lib/utapi/utapi.js index e4f25d9ced..b9e562fec0 100644 --- a/lib/utapi/utapi.js +++ b/lib/utapi/utapi.js @@ -1,3 +1,4 @@ +require('werelogs').stderrUtils.catchAndTimestampStderr(); const _config = require('../Config').config; const { utapiVersion, UtapiServer: utapiServer } = require('utapi'); diff --git a/lib/utapi/utapiReindex.js b/lib/utapi/utapiReindex.js index 9e86e3abe6..9bc1522355 100644 --- a/lib/utapi/utapiReindex.js +++ b/lib/utapi/utapiReindex.js @@ -1,3 +1,4 @@ +require('werelogs').stderrUtils.catchAndTimestampStderr(); const UtapiReindex = require('utapi').UtapiReindex; const { config } = require('../Config'); diff --git a/lib/utapi/utapiReplay.js b/lib/utapi/utapiReplay.js index 3e20055b8c..c9202cb158 100644 --- a/lib/utapi/utapiReplay.js +++ b/lib/utapi/utapiReplay.js @@ -1,3 +1,4 @@ +require('werelogs').stderrUtils.catchAndTimestampStderr(); const UtapiReplay = require('utapi').UtapiReplay; const _config = require('../Config').config; From cd9e2e757bf97d54f1102278bd9bc673fb3f2998 Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Sun, 30 Jun 2024 21:15:52 +0200 Subject: [PATCH 3/3] CLDSRV-544: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d060ed8047..4a08dffaab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "s3", - "version": "7.10.48", + "version": "7.10.49", "description": "S3 connector", "main": "index.js", "engines": {