From 9738b714ea7b01e996186abde0ce229707a39895 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 24 Jul 2015 10:23:12 +0000 Subject: [PATCH 1/3] Adding stack trace and crash information to logs when a service crashes --- package.json | 3 ++- plugins/c9.error/raygun.connect.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d25b2f9..c0626b89 100644 --- a/package.json +++ b/package.json @@ -111,6 +111,7 @@ "c9.ide.threewaymerge": "#229382aa0b", "c9.ide.undo": "#b028bcb4d5", "c9.ide.upload": "#0bd010d3dc", - "c9.ide.welcome": "#c370b3f191" + "c9.ide.welcome": "#c370b3f191", + "smf.core": "#undefined" } } \ No newline at end of file diff --git a/plugins/c9.error/raygun.connect.js b/plugins/c9.error/raygun.connect.js index 6511ef58..0939c28b 100644 --- a/plugins/c9.error/raygun.connect.js +++ b/plugins/c9.error/raygun.connect.js @@ -29,6 +29,9 @@ function plugin(options, imports, register) { try { // make sure we close down within 10 seconds console.error("Uncaught exception. Logging error and shutting down in 10 sec"); + console.error("Exception:", err); + console.error("Exception stack:", err.stack); + console.error("Our current stack: ", new Error().stack); var killtimer = setTimeout(function() { console.error("Exiting after uncaught exception"); console.error(err.stack || err); From c7d7a9d703bfbfd0f7d9db79fe105776f9be975f Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 24 Jul 2015 10:33:41 +0000 Subject: [PATCH 2/3] Adding more custom data so we can track down server crashes --- plugins/c9.error/raygun.connect.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/c9.error/raygun.connect.js b/plugins/c9.error/raygun.connect.js index 0939c28b..76766ebd 100644 --- a/plugins/c9.error/raygun.connect.js +++ b/plugins/c9.error/raygun.connect.js @@ -23,6 +23,10 @@ function plugin(options, imports, register) { connect.useStart(function(req, res, next) { var d = domain.create(); d.on("error", function(err) { + raygun.customData = raygun.customData || {}; + raygun.customData.serverCrashed = true; + raygun.customData.exceptionStack = err.stack; + raygun.customData.crashStack = new Error().stack; sendRequestError(err, req); // from http://nodejs.org/api/domain.html From 9597e3019bef3d70300af45026c9dfd73f8a9cf6 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 24 Jul 2015 15:34:46 +0200 Subject: [PATCH 3/3] Removing duplicate exception information --- plugins/c9.error/raygun.connect.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/c9.error/raygun.connect.js b/plugins/c9.error/raygun.connect.js index 76766ebd..ad0cbc64 100644 --- a/plugins/c9.error/raygun.connect.js +++ b/plugins/c9.error/raygun.connect.js @@ -38,7 +38,6 @@ function plugin(options, imports, register) { console.error("Our current stack: ", new Error().stack); var killtimer = setTimeout(function() { console.error("Exiting after uncaught exception"); - console.error(err.stack || err); process.exit(1); }, 10000); // But don't keep the process open just for that! @@ -108,4 +107,4 @@ function plugin(options, imports, register) { sendRequestError: sendRequestError, sendRequestWarning: sendRequestWarning }}); -} \ No newline at end of file +}